Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abranhe/arg
Parse command-line arguments made easier.
https://github.com/abranhe/arg
argc argument-parser arguments argv cli command-line pip python
Last synced: 3 days ago
JSON representation
Parse command-line arguments made easier.
- Host: GitHub
- URL: https://github.com/abranhe/arg
- Owner: abranhe
- License: mit
- Created: 2018-09-06T05:23:29.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2021-09-19T07:00:54.000Z (about 3 years ago)
- Last Synced: 2024-10-12T12:15:28.959Z (about 1 month ago)
- Topics: argc, argument-parser, arguments, argv, cli, command-line, pip, python
- Language: Python
- Homepage: https://projects.abranhe.com/arg
- Size: 9.77 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
πΌππ
: Parse command line arguments made easier...# Install
```
pip install arg
```# Usage
```
$ python test.py ford -m mustang --year 2017 red
```> *test.py*
```py
import arg# argv without file name
print(arg())
# => ['ford', '-m', 'mustang', '--year', '2017', 'red']# argv
print(arg.v())
# => ['test.py', 'ford', '-m', 'mustang', '--year', '2017', 'red']# argc
print(arg.c())
# => 7# args as string
print(arg.s())
# => test.py ford -m mustang --year 2017 red# file name
print(arg.fileName())
# => test.py# argument at n
print(arg.at(2))
# => -m```
# API
### `arg()`
> Return an array with the arguments without the file name
**Return Type**: `list`
### `.v()`
> Return an array with all the arguments. (**arg.v** ~> argv *Argumet Vector*)
**Return Type**: `list`
### `.c()`
> Return an array with all the arguments. (**arg.c** ~> argc *Argument Count*)
**Return Type**: `int`
### `.s()`
> Return an string with all the arguments. (arg.s ~> Arguments to String)
**Return Type**: `str`
### `.fileName()`
> Return an string with the name of the file
**Return Type**: `str`
### `.at(n)`
> Return the value of the argument at value at **n**, otherwise **404**
**Return Type**: `str`
# Related
- [**lupe**](https://github.com/abranhe/lupe): A better CLI Helper.
# Team
|[![Carlos Abraham Logo](https://avatars3.githubusercontent.com/u/21347264?s=50&v=4)](https://abranhe.com)|
| :-: |
| [Carlos Abraham](https://github.com/abranhe) |# License
[MIT](https://github.com/abranhe/arg/blob/master/LICENSE) License Β© [Carlos Abraham](https://github.com/abranhe/)