Path-and-Address
================
Functions for command-line server tools used by humans.
Description
-----------
Path-and-address resolves ambiguities for command-line interface applications
with the following pattern:
```bash
$ your_app [<path>] [<address>]
```
The library applies [the principal of least surprise][pols] to command-line
interfaces.
Some examples:
```bash
$ your_app .
* Serving . on http://localhost:5000/
$ your_app 80
* Serving . on http://localhost:80/
$ your_app ./80
* Serving ./80 on http://localhost:5000/
$ your_app path/to/file
* Serving path/to/file on http://localhost:5000/
$ your_app 0.0.0.0
* Serving 0.0.0.0 on http://localhost:5000/
$ your_app . 0.0.0.0
* Serving . on http://0.0.0.0:5000/
$ your_app 0.0.0.0:8080
* Serving . on http://0.0.0.0:8080/
```
Usage
-----
Implement a CLI front-end in Python that exposes the above `[path] [address]`
pattern. Then call `resolve(path, address)`.
Example, using `sys.argv` directly:
```python
import sys
from path_and_pattern import resolve
path, address = resolve(*argv[1:])
```
More examples can be found in the "examples" directory.
Installation
------------
To install, simply:
```bash
$ pip install path-and-address
```
Or put it in your project's `requirements.txt`.
Contributing
------------
1. Check the open issues or open a new issue to start a discussion around
your feature idea or the bug you found
2. Fork the repository, make your changes, and add yourself to [Authors.md][]
3. Send a pull request
[pols]: http://en.wikipedia.org/wiki/Principle_of_least_astonishment
[authors.md]: ./AUTHORS.md
Raw data
{
"_id": null,
"home_page": "http://github.com/joeyespo/path-and-address",
"name": "path-and-address",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Joe Esposito",
"author_email": "joe@joeyespo.com",
"download_url": "https://files.pythonhosted.org/packages/2b/b5/749fab14d9e84257f3b0583eedb54e013422b6c240491a4ae48d9ea5e44f/path-and-address-2.0.1.zip",
"platform": "any",
"description": "Path-and-Address\r\n================\r\n\r\nFunctions for command-line server tools used by humans.\r\n\r\n\r\nDescription\r\n-----------\r\n\r\nPath-and-address resolves ambiguities for command-line interface applications\r\nwith the following pattern:\r\n\r\n```bash\r\n$ your_app [<path>] [<address>]\r\n```\r\n\r\nThe library applies [the principal of least surprise][pols] to command-line\r\ninterfaces.\r\n\r\nSome examples:\r\n\r\n```bash\r\n$ your_app .\r\n * Serving . on http://localhost:5000/\r\n\r\n$ your_app 80\r\n * Serving . on http://localhost:80/\r\n\r\n$ your_app ./80\r\n * Serving ./80 on http://localhost:5000/\r\n\r\n$ your_app path/to/file\r\n * Serving path/to/file on http://localhost:5000/\r\n\r\n$ your_app 0.0.0.0\r\n * Serving 0.0.0.0 on http://localhost:5000/\r\n\r\n$ your_app . 0.0.0.0\r\n * Serving . on http://0.0.0.0:5000/\r\n\r\n$ your_app 0.0.0.0:8080\r\n * Serving . on http://0.0.0.0:8080/\r\n```\r\n\r\n\r\nUsage\r\n-----\r\n\r\nImplement a CLI front-end in Python that exposes the above `[path] [address]`\r\npattern. Then call `resolve(path, address)`.\r\n\r\nExample, using `sys.argv` directly:\r\n\r\n```python\r\nimport sys\r\nfrom path_and_pattern import resolve\r\n\r\npath, address = resolve(*argv[1:])\r\n```\r\n\r\nMore examples can be found in the \"examples\" directory.\r\n\r\n\r\nInstallation\r\n------------\r\n\r\nTo install, simply:\r\n\r\n```bash\r\n$ pip install path-and-address\r\n```\r\n\r\nOr put it in your project's `requirements.txt`.\r\n\r\n\r\nContributing\r\n------------\r\n\r\n1. Check the open issues or open a new issue to start a discussion around\r\n your feature idea or the bug you found\r\n2. Fork the repository, make your changes, and add yourself to [Authors.md][]\r\n3. Send a pull request\r\n\r\n\r\n[pols]: http://en.wikipedia.org/wiki/Principle_of_least_astonishment\r\n[authors.md]: ./AUTHORS.md\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Functions for server command-line arguments used by humans.",
"version": "2.0.1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "4c9799605f1b3c0b2ecc62779ef1b205",
"sha256": "e96363d982b3a2de8531f4cd5f086b51d0248b58527227d43cf5014d045371b7"
},
"downloads": -1,
"filename": "path-and-address-2.0.1.zip",
"has_sig": false,
"md5_digest": "4c9799605f1b3c0b2ecc62779ef1b205",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 6503,
"upload_time": "2016-07-21T02:56:09",
"upload_time_iso_8601": "2016-07-21T02:56:09.794588Z",
"url": "https://files.pythonhosted.org/packages/2b/b5/749fab14d9e84257f3b0583eedb54e013422b6c240491a4ae48d9ea5e44f/path-and-address-2.0.1.zip",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2016-07-21 02:56:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "joeyespo",
"github_project": "path-and-address",
"travis_ci": true,
"coveralls": false,
"github_actions": false,
"lcname": "path-and-address"
}