GithubHelp home page GithubHelp logo

abranhe / arg Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 10 KB

Parse command-line arguments made easier.

Home Page: https://projects.abranhe.com/arg

License: MIT License

Python 100.00%
pip python arguments argc argv argument-parser cli command-line

arg's Introduction




π˜Όπ™π™‚ : Parse command line arguments made easier...

Install

pip install arg

Usage

$ python test.py ford -m mustang --year 2017 red

test.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: A better CLI Helper.

Team

Carlos Abraham Logo
Carlos Abraham

License

MIT License Β© Carlos Abraham

arg's People

Contributors

abranhe avatar ezner avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

ezner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.