[Question] Simple version printing
See original GitHub issue1. Problem
In most programs, what I use, I can get version, use --version
and -v
command line arguments without additional parameters.
D:\SashaPythonista>python SashaAscent.py --version
Do Nothing version 0.2
or
D:\SashaPythonista>python SashaAscent.py -v
0.2
I don’t understand, how I can to create the same behavior, if I write a program, use Clize.
2. Attempts
1. First
from clize import run
VERSION = "0.2"
def program_version(version):
print(VERSION)
run(program_version)
That get a version, I need input version
, not --version
:
D:\SashaPythonista>python SashaAscent.py version
0.2
D:\SashaPythonista>python SashaAscent.py --version
SashaAscent.py: Unknown option '--version'
Usage: SashaAscent.py version
2. Second
from clize import run
VERSION = "0.2"
def program_version(b="VERSION", *, version:'v'=True):
"""Show the version"""
if version is True:
b = "0.2"
print(b)
run(program_version)
I need input -v b
, not -v
:
D:\SashaPythonista>python SashaAscent.py -v b
0.2
3. Third
from clize import run
VERSION = "0.2"
def do_nothing():
"""Does nothing"""
return "I did nothing, I swear!"
def version():
"""Show the version"""
print(VERSION)
run(do_nothing, alt=version)
It works for --version
,
D:\SashaPythonista>python SashaAscent.py --version
0.2
but I don’t find, how I can to create alias -v
.
4. Fourth
It works nice.
from clize import run
VERSION = "0.2"
def do_nothing():
"""Does nothing"""
return "I did nothing, I swear!"
def version():
"""Show the version"""
print(VERSION)
def v():
"""Show the version"""
print(VERSION)
run(do_nothing, alt=[version, v])
But in --help
menu -v
is not --version
alias.
Actual:
D:\SashaPythonista>python SashaAscent.py --help
Usage: SashaAscent.py
Does nothing
Other actions:
-h, --help Show the help
--version Show the version
-v Show the version
Expected:
D:\SashaPythonista>python SashaAscent.py --help
Usage: SashaAscent.py
Does nothing
Other actions:
-h, --help Show the help
-v, --version Show the version
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
9 Important Questions To Ask Your Printer Before You Design
Here are some common questions to ask your printer before working on your design to help you have a seamless product from design...
Read more >10 questions you should ask your printer - Swallowtail Print
10 questions you should ask your printer · 1. What are the most cost effective options? · 2. What paper stock can I...
Read more >Print any Pattern easily & Get solutions| Interview ... - YouTube
Print any Pattern easily & Get solutions| Interview question answers | Explained in detail ; http://bit.ly/2Hf1aUC connect with me here: ; https ...
Read more >Print Test Questions - GoGuardian
The first print option allows you to make a hardcopy of any assignment, with the assessment questions unanswered, so your students can answer ......
Read more >Get Rid of Paper Clutter By Asking 2 Simple Questions
Until you start asking these questions, you'll continue to print and save paper without really understanding why. 1. Why Should I Print This?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It doesn’t look like there is a way to have aliases for an ‘alt=’ function yet, sorry.
I’ll look into it.
I can’t really do that, users might use
-v
for--verbose
or anything else, whether or not they use--version