fargv-0.1.8b0
توضیحات
A very easy to use argument parser.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | fargv-0.1.8b0 |
| نام | fargv |
| نسخه کتابخانه | 0.1.8b0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Anguelos Nicolaou |
| ایمیل نویسنده | anguelos.nicolaou@gmail.com |
| آدرس صفحه اصلی | https://github.com/anguelos/fargv |
| آدرس اینترنتی | https://pypi.org/project/fargv/ |
| مجوز | MIT |
# fargv: The laziest command-line argument parser
## Installation
```bash
pip3 pip install --user --upgrade git+https://github.com/anguelos/fargv
```
## Usage in 3 Simple Steps!
Fast argument parser
* Import
```python
"""
The script's docstring Becomes the general description in the help if defined
"""
from fargv import fargv
```
* Define a dictionary with default parameters
```python
params = {
"anInt": 1,
"aFloat": 0.1,
"aBoolean": False,
"anotherBoolean": True,
"aString": "Hello",
"aStringReference": "{aString} World",
"anIntWithHelp": [2,"This would be the help"],
"aChoice": [("choice1","choice2","choice3","choice4"),"And this must be the help"],
"aPositionalSwitch": [set([]), "This is a convenient way to pass colections of things"]
}
```
* Parse user provided argv to override defaults
```python
new_params, help_str = fargv(params)
```
* In shell:
```bash
my_program -anInt 34 -aFloat=2.3 -aBoolean -anotherBoolean=False
```
## Features:
* Type checking
* Automatic help generation
* Params usable as dictionary or struct
* Can read environmental variables as well
* macro-parameters
* fast autocomplete generation
* Switches with positional values
### Autocomplete
Static autocomplete for any program using fargv can be enabled with a single command.
The following command enables autocomplete for fargv_demo.py in the current shell where it is run.
```bash
source <(./examples/fargv_demo.py -bash_autocomplete)
```
fargv_demo.py should be an executable file employing the shebang (#!/usr/bin/env python3) or something equivalent.
For a temporary solution, the autocomplete bash code can go in a script in /etc/bash_completion.d or in .bashrc.
### Switch Macros
A switch might be a macro for other switches.
This allows for example to break many files into a single root switch and all other switches beeing file names relative to that path.
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.6 | Python |
نحوه نصب
نصب پکیج whl fargv-0.1.8b0:
pip install fargv-0.1.8b0.whl
نصب پکیج tar.gz fargv-0.1.8b0:
pip install fargv-0.1.8b0.tar.gz