Pre-release
This release is a pre-release and may not be stable for production use.
This is a helper module for making intuitive command line programs with
zero effort. It takes a function signature like:
example_function(string1, string2='something', string3='something else')
and turns it into a simple command-line app with usage:
example_program string1 [string2 [string3]]
All you have to do is:
if __name__ == "__main__":
import commandline
commandline.run_as_main(example_function)
Limitations
============
Note that it currently can't print help information for arguments other than their default values,
but it will print your docstring for you if that's of any use.
Help for arguments will probably come with python3000's function annotations.
http://www.python.org/dev/peps/pep-3107/
Argument types are inferred from the default arguments. Currently supported are:
int, float, bool, str, commandline.Choice
If things don't have a default argument, I can't infer the type, so assume str.
zero effort. It takes a function signature like:
example_function(string1, string2='something', string3='something else')
and turns it into a simple command-line app with usage:
example_program string1 [string2 [string3]]
All you have to do is:
if __name__ == "__main__":
import commandline
commandline.run_as_main(example_function)
Limitations
============
Note that it currently can't print help information for arguments other than their default values,
but it will print your docstring for you if that's of any use.
Help for arguments will probably come with python3000's function annotations.
http://www.python.org/dev/peps/pep-3107/
Argument types are inferred from the default arguments. Currently supported are:
int, float, bool, str, commandline.Choice
If things don't have a default argument, I can't infer the type, so assume str.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
commandline-0.1.2dev.tar.gz
(5.4 kB
view details)
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
commandline-0.1.2dev-py2.5.egg
(15.7 kB
view details)
File details
Details for the file commandline-0.1.2dev.tar.gz.
File metadata
- Download URL: commandline-0.1.2dev.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfc8ef849fba7a851f55e8d54222c949c1ce7da86412fb3a56978f04ebc40f2a
|
|
| MD5 |
e74b68d9b1e31620fbf872ed4cc37da9
|
|
| BLAKE2b-256 |
a1c86e5d1a8e8f911e6b75c8158c56cca9c86c5bd9f142047a6bf7ba0946f778
|
File details
Details for the file commandline-0.1.2dev.linux-x86_64.tar.gz.
File metadata
- Download URL: commandline-0.1.2dev.linux-x86_64.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
269a559d4ef8805ad5e3b5a1cd55e8a00f95c4be4b65671003b0f21c4d5289c1
|
|
| MD5 |
cf6af4d5c7a89d5df74469a370df508d
|
|
| BLAKE2b-256 |
1816737abfd73d5201b5db516830b3e0e0d7fc46a593959b45b0f9ac7b862c1d
|
File details
Details for the file commandline-0.1.2dev-py2.5.egg.
File metadata
- Download URL: commandline-0.1.2dev-py2.5.egg
- Upload date:
- Size: 15.7 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7535be4c75f45199fb7249e6a5899f2e8745fd463cc7bb4a66db7afe51a795f9
|
|
| MD5 |
1aa0a327d089ca10bc0d3179b7f65e4c
|
|
| BLAKE2b-256 |
56d2364d0cdc0dbe2d637596f248bb4cec45576573e9cc7dcf70364411ab2b86
|