# betterargs
A tool to create a command-line interface for your app using python
## Installation
- **Requirements**
- python3.10
- pip3
```bash
pip install betterargs
```
## Releases
Packaging and releases are handled in the [packaging branch](https://github.com/danielmuringe/betterargs/tree/packaging).
MAIN BRANCH IS RESERVED FOR MAINTAINING CODE ONLY!!!
- [version 0.0.3](https://github.com/danielmuringe/betterargs/releases/tag/v0.0.3)
- [version 0.0.2](https://github.com/danielmuringe/betterargs/releases/tag/v.0.0.2)
## Usage
- Create a command string in YAML format in a:
1. YAML file
2. Python dictionary
3. Python string
- Convert the yaml file to command line namespace using appropriate function
### 1. Using a [YAML file](https://github.com/danielmuringe/betterargs/tree/dev/testing/command_tree.yaml)
```yaml
# Create command tree in a yaml file
git:
args:
path:
atype: flag
help: Path of the repo
subparsers:
parsers:
clone:
args:
quiet-clone:
atype: flag
help: Operate quietly. Progress is not reported to the standard error stream.
no-checkout:
help: No checkout of HEAD is performed after the clone is complete
init:
args:
quiet-init:
atype: flag
help: Operate quietly. Progress is not reported to the standard error stream.
```
```python
# Import betterargs
import betterargs
# Create command line namespace and get arguments
command_tree_PATH = 'command_tree.yaml'
args = betterargs.format_path_tree(command_tree_PATH)
```
### 2. Using [Python Dictionary in YAML Format](https://github.com/danielmuringe/betterargs/blob/dev/testing/format_dict_tree_test.py)
```python
# Import betterargs
import betterargs
# Define command tree in a dictionary in YAML format
command_tree_DICT = {
"git": {
"args": {
"path": {
"atype": "flag",
"help": "Path of the repo",
},
},
"subparsers": {
"parsers": {
"clone": {
"args": {
"quiet-clone": {
"atype": "flag",
"help": "Operate quietly. Progress is not reported to the standard error stream.",
},
"no-checkout": {
"help": "No checkout of HEAD is performed after the clone is complete"
},
},
},
"init": {
"args": {
"quiet-init": {
"atype": "flag",
"help": "Operate quietly. Progress is not reported to the standard error stream.",
},
},
},
},
},
},
}
# Create command line namespace and get arguments
args = betterargs.format_dict_tree(command_tree_DICT)
```
### 3. Using [string in YAML Format](https://github.com/danielmuringe/betterargs/blob/dev/testing/format_str_tree_test.py)
```python
# Import betterargs
import betterargs
# Define command tree in a string in YAML format
command_tree_STR = """
git:
args:
path:
atype: flag
help: Path of the repo
subparsers:
parsers:
clone:
args:
quiet-clone:
atype: flag
help: Operate quietly. Progress is not reported to the standard error stream.
no-checkout:
help: No checkout of HEAD is performed after the clone is complete
init:
args:
quiet-init:
atype: flag
help: Operate quietly. Progress is not reported to the standard error stream.
"""
# Create command line namespace and get arguments
args = betterargs.format_str_tree(command_tree_STR)
```
## Contributors
- Author: [Daniel Muringe](https://danielmuringe.github.io/)
## Contribution
You are more than welcome to contribute 😊
### Process
It's simple!!!
- Fork the github repo
- Clone the github repo
```bash
git clone https://github.com/danielmuringe/betterargs
```
- Make your modifications in the [dev branch](https://github.com/danielmuringe/betterargs/tree/dev)
- Merge into main branch respecting the .gitignore of the main branch. **KEEP IT CLEAN PLEASE !!!**
- Create pull request
- Wait for confirmation
### Rules
1. Active changes must take place in the [dev branch](https://github.com/danielmuringe/betterargs/tree/dev). Active changes include:
- Changes to [betterargs module](https://github.com/danielmuringe/betterargs/tree/dev/betterargs)
- Modification of development notes [betterargs module](https://github.com/danielmuringe/betterargs/tree/dev/betterargs/notes.md)
- Changes to the [project tests](https://github.com/danielmuringe/betterargs/tree/dev/betterargs/testing)
2. Tests must be put in the [testing directory of dev branch](https://github.com/danielmuringe/betterargs/tree/dev/testing)
3. All packaging must be done in the [packaging branch](https://github.com/danielmuringe/betterargs/tree/packaging)
Other rules will be added at my discretion
## Tests
- Tests can be found in the [testing directory of dev branch](https://github.com/danielmuringe/betterargs/tree/dev/testing)
## Documentation
Coming Soon 😊
Raw data
{
"_id": null,
"home_page": "",
"name": "betterargs",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": "",
"keywords": "argument parser,boilerplate,yaml,command-line,command-line-tool,argparse,build tools,args",
"author": "DanielMuringe",
"author_email": "<danielmuringe@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/41/e0/b1f11eafb7bc9f5f69c3b9a859034cd64bad19a33ee9f36b12a5f39bb0a6/betterargs-0.0.3.tar.gz",
"platform": null,
"description": "\n# betterargs\n\nA tool to create a command-line interface for your app using python\n\n## Installation\n\n- **Requirements**\n - python3.10\n - pip3\n\n```bash\npip install betterargs\n```\n\n## Releases\n\nPackaging and releases are handled in the [packaging branch](https://github.com/danielmuringe/betterargs/tree/packaging).\n\nMAIN BRANCH IS RESERVED FOR MAINTAINING CODE ONLY!!!\n\n- [version 0.0.3](https://github.com/danielmuringe/betterargs/releases/tag/v0.0.3)\n\n- [version 0.0.2](https://github.com/danielmuringe/betterargs/releases/tag/v.0.0.2)\n\n\n## Usage\n\n- Create a command string in YAML format in a:\n 1. YAML file\n 2. Python dictionary\n 3. Python string\n\n- Convert the yaml file to command line namespace using appropriate function\n\n### 1. Using a [YAML file](https://github.com/danielmuringe/betterargs/tree/dev/testing/command_tree.yaml)\n```yaml\n# Create command tree in a yaml file\n\ngit:\n args:\n path:\n atype: flag\n help: Path of the repo\n subparsers:\n parsers:\n clone:\n args:\n quiet-clone:\n atype: flag\n help: Operate quietly. Progress is not reported to the standard error stream.\n no-checkout:\n help: No checkout of HEAD is performed after the clone is complete\n init:\n args:\n quiet-init:\n atype: flag\n help: Operate quietly. Progress is not reported to the standard error stream.\n```\n\n\n```python\n# Import betterargs\nimport betterargs\n\n\n# Create command line namespace and get arguments\ncommand_tree_PATH = 'command_tree.yaml'\n\nargs = betterargs.format_path_tree(command_tree_PATH)\n```\n\n### 2. Using [Python Dictionary in YAML Format](https://github.com/danielmuringe/betterargs/blob/dev/testing/format_dict_tree_test.py)\n\n```python\n# Import betterargs\nimport betterargs\n\n\n# Define command tree in a dictionary in YAML format\ncommand_tree_DICT = {\n \"git\": {\n \"args\": {\n \"path\": {\n \"atype\": \"flag\",\n \"help\": \"Path of the repo\",\n },\n },\n \"subparsers\": {\n \"parsers\": {\n \"clone\": {\n \"args\": {\n \"quiet-clone\": {\n \"atype\": \"flag\",\n \"help\": \"Operate quietly. Progress is not reported to the standard error stream.\",\n },\n \"no-checkout\": {\n \"help\": \"No checkout of HEAD is performed after the clone is complete\"\n },\n },\n },\n \"init\": {\n \"args\": {\n \"quiet-init\": {\n \"atype\": \"flag\",\n \"help\": \"Operate quietly. Progress is not reported to the standard error stream.\",\n },\n },\n },\n },\n },\n },\n}\n\n\n# Create command line namespace and get arguments\nargs = betterargs.format_dict_tree(command_tree_DICT)\n```\n\n### 3. Using [string in YAML Format](https://github.com/danielmuringe/betterargs/blob/dev/testing/format_str_tree_test.py)\n\n\n```python\n# Import betterargs\nimport betterargs\n\n\n# Define command tree in a string in YAML format\ncommand_tree_STR = \"\"\"\ngit:\n args:\n path:\n atype: flag\n help: Path of the repo\n subparsers:\n parsers:\n clone:\n args:\n quiet-clone:\n atype: flag\n help: Operate quietly. Progress is not reported to the standard error stream.\n no-checkout:\n help: No checkout of HEAD is performed after the clone is complete\n init:\n args:\n quiet-init:\n atype: flag\n help: Operate quietly. Progress is not reported to the standard error stream.\n\"\"\"\n\n\n# Create command line namespace and get arguments\nargs = betterargs.format_str_tree(command_tree_STR)\n\n```\n\n\n## Contributors\n- Author: [Daniel Muringe](https://danielmuringe.github.io/)\n\n\n## Contribution\n\nYou are more than welcome to contribute \ud83d\ude0a\n\n\n### Process\n\nIt's simple!!!\n\n- Fork the github repo\n\n- Clone the github repo\n\n```bash\ngit clone https://github.com/danielmuringe/betterargs\n```\n\n- Make your modifications in the [dev branch](https://github.com/danielmuringe/betterargs/tree/dev)\n\n- Merge into main branch respecting the .gitignore of the main branch. **KEEP IT CLEAN PLEASE !!!**\n\n- Create pull request\n\n- Wait for confirmation\n\n### Rules\n1. Active changes must take place in the [dev branch](https://github.com/danielmuringe/betterargs/tree/dev). Active changes include:\n\n - Changes to [betterargs module](https://github.com/danielmuringe/betterargs/tree/dev/betterargs)\n\n - Modification of development notes [betterargs module](https://github.com/danielmuringe/betterargs/tree/dev/betterargs/notes.md)\n\n - Changes to the [project tests](https://github.com/danielmuringe/betterargs/tree/dev/betterargs/testing)\n\n2. Tests must be put in the [testing directory of dev branch](https://github.com/danielmuringe/betterargs/tree/dev/testing)\n\n3. All packaging must be done in the [packaging branch](https://github.com/danielmuringe/betterargs/tree/packaging)\n\nOther rules will be added at my discretion\n\n\n## Tests\n- Tests can be found in the [testing directory of dev branch](https://github.com/danielmuringe/betterargs/tree/dev/testing)\n\n\n## Documentation\nComing Soon \ud83d\ude0a\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A tool to create a command-line interface for your app using python",
"version": "0.0.3",
"project_urls": {
"Source": "https://www.github.com/danielmuringe/betterargs",
"Tracker": "https://www.github.com/danielmuringe/betterargs/issues"
},
"split_keywords": [
"argument parser",
"boilerplate",
"yaml",
"command-line",
"command-line-tool",
"argparse",
"build tools",
"args"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1e31291daf32192a2902e2afc156e9358aef7e7e3ffa307ee96965205a32fd87",
"md5": "0e3ea44fd8844494ee37ed4bba88356e",
"sha256": "7f5c80a2f646c692fa86a33b78d2dfc4cb716a377664857ace1f27c8af19f8e8"
},
"downloads": -1,
"filename": "betterargs-0.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0e3ea44fd8844494ee37ed4bba88356e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 4405,
"upload_time": "2023-12-29T12:48:13",
"upload_time_iso_8601": "2023-12-29T12:48:13.447203Z",
"url": "https://files.pythonhosted.org/packages/1e/31/291daf32192a2902e2afc156e9358aef7e7e3ffa307ee96965205a32fd87/betterargs-0.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "41e0b1f11eafb7bc9f5f69c3b9a859034cd64bad19a33ee9f36b12a5f39bb0a6",
"md5": "83f241ebac996495660c61a6cd530bae",
"sha256": "7c3e900b1313dd2bffd33e5b4ff34e5db37590138a243fd7f091a93707a9304a"
},
"downloads": -1,
"filename": "betterargs-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "83f241ebac996495660c61a6cd530bae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 4560,
"upload_time": "2023-12-29T12:48:15",
"upload_time_iso_8601": "2023-12-29T12:48:15.448554Z",
"url": "https://files.pythonhosted.org/packages/41/e0/b1f11eafb7bc9f5f69c3b9a859034cd64bad19a33ee9f36b12a5f39bb0a6/betterargs-0.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-29 12:48:15",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "danielmuringe",
"github_project": "betterargs",
"github_not_found": true,
"lcname": "betterargs"
}