tobimensch / cli2man Goto Github PK
View Code? Open in Web Editor NEWConverts the help message of a program into a manpage
Converts the help message of a program into a manpage
Hi,
I can't figure out why the last character is cut off from my --help outputs "Name description"
my command spits out something like this:
usage: command [-h] [-v] [-o] {arg1,arg2} ...
The ProjectNAME command description
cli2man gives me that
.Nm command
.Nd the projectname command descriptio
no matter what i write as "the command description", the very last character always gets cut off.
also I would like to know if I could use capital letters also in this description (my commands -h does use them!) or if this is a limitation of .mdoc format itself. seems like currently cli2man tranlates caps to non-caps here.
I am using Python 2.7.16 installed via homebrew on macOS 10.13.6
thanks a lot!
Jojo
$ cli2man haiti
File "/tmp/venv/bin/cli2man", line 1376
os.chmod(opt['--create-script'], st.st_mode | 0111 )
^
SyntaxError: leading zeros in decimal integer literals are not permitted; use an 0o prefix for octal integers
haiti use docopt
$ haiti --help
HAITI (HAsh IdenTifIer) v1.4.1
Usage:
haiti [options] <hash>
haiti samples (<ref> | <name>)
haiti -h | --help
haiti --version
Commands:
samples Display hash samples for the given type
Parameters:
<hash> Hash string to identify, read from STDIN if equal to "-"
<ref> hashcat or john the ripper reference
<name> Hash type name
Options:
--no-color Disable colorized output
-e, --extended List all possible hash algorithms including ones using salt
--short Display in a short format: do not display hashcat and john the ripper references
--hashcat-only Show only hashcat references
--john-only Show only john the ripper references
--debug Display arguments
-h, --help Show this screen
--version Show version
Examples:
haiti -e d41d8cd98f00b204e9800998ecf8427e
haiti --no-color --short d41d8cd98f00b204e9800998ecf8427e
b2sum /etc/os-release | awk '{print $1}' | haiti -
haiti samples crc32
But I guess it's rather due to using python 2 cf. #11
Hi!
Python2 is now being replaced in numerous distribution by Python3 as the default python implementation.
This program is really nice and I would hate to see it die slowly because of a lack of update to python3...
Since Python 2 has reached sunset, please update this very useful tool to Python 3. Thanks!
Hi again,
cli2man runs perfectly with Python2.7.x but I get a syntax error when invoking with Python3.7.x.
Eg. you are using a syntax for the print statement that is not supported anymore:
print "foo"
instead of
print("foo")
just sayin because I didn't find a statement in your README which Python version is required :-)
HTH
Jojo
On Windows 8, using python 2.7.10 and pip 7.1.2, I get the following error:
C:\Python27\Scripts>pip.exe install cli2man
Collecting cli2man
Downloading cli2man-0.2.2.tar.gz
Requirement already satisfied (use --upgrade to upgrade): docopt in c:\python27\
lib\site-packages (from cli2man)
Building wheels for collected packages: cli2man
Running setup.py bdist_wheel for cli2man
Complete output from command C:\Python27\python.exe -c "import setuptools;__fi
le__='c:\\users\\mike\\appdata\\local\\temp\\pip-build-o1d5xd\\cli2man\\setup.py
';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))"
bdist_wheel -d c:\users\mike\appdata\local\temp\tmpb4eteupip-wheel-:
running bdist_wheel
running build
running build_scripts
creating build
creating build\scripts-2.7
copying and adjusting cli2man -> build\scripts-2.7
installing to build\bdist.win32\wheel
running install
running install_data
creating build\bdist.win32
creating build\bdist.win32\wheel
creating build\bdist.win32\wheel\cli2man-0.2.2.data
creating build\bdist.win32\wheel\cli2man-0.2.2.data\data
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\mike\appdata\local\temp\pip-build-o1d5xd\cli2man\setup.py", l
ine 13, in <module>
data_files=[('/usr/share/man/man1/', ['cli2man.1.gz'])]
File "C:\Python27\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\wheel\bdist_wheel.py", line 211, in run
self.run_command('install')
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\install.py", line 61,
in run
return orig.install.run(self)
File "C:\Python27\lib\distutils\command\install.py", line 575, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\install_data.py", line 58, in run
dir = convert_path(f[0])
File "C:\Python27\lib\distutils\util.py", line 124, in convert_path
raise ValueError, "path '%s' cannot be absolute" % pathname
ValueError: path '/usr/share/man/man1/' cannot be absolute
----------------------------------------
Failed building wheel for cli2man
Failed to build cli2man
Installing collected packages: cli2man
Running setup.py install for cli2man
Complete output from command C:\Python27\python.exe -c "import setuptools, t
okenize;__file__='c:\\users\\mike\\appdata\\local\\temp\\pip-build-o1d5xd\\cli2m
an\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().repl
ace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\mike\appdata\lo
cal\temp\pip-mrwdan-record\install-record.txt --single-version-externally-manage
d --compile:
running install
running build
running build_scripts
running install_data
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\mike\appdata\local\temp\pip-build-o1d5xd\cli2man\setup.py",
line 13, in <module>
data_files=[('/usr/share/man/man1/', ['cli2man.1.gz'])]
File "C:\Python27\lib\distutils\core.py", line 151, in setup
dist.run_commands()
File "C:\Python27\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\site-packages\setuptools\command\install.py", line 6
1, in run
return orig.install.run(self)
File "C:\Python27\lib\distutils\command\install.py", line 575, in run
self.run_command(cmd_name)
File "C:\Python27\lib\distutils\cmd.py", line 326, in run_command
self.distribution.run_command(command)
File "C:\Python27\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\Python27\lib\distutils\command\install_data.py", line 58, in run
dir = convert_path(f[0])
File "C:\Python27\lib\distutils\util.py", line 124, in convert_path
raise ValueError, "path '%s' cannot be absolute" % pathname
ValueError: path '/usr/share/man/man1/' cannot be absolute
It doesn't play nicely :(
I don't know much about this project (a coworker wished to add it to our project's requirements, and we develop on a variety of OSes) but if it's not meant to work on Windows can you mention that in the description?
Hi,
my program has subcommands that have their own extensive --help output.
command -h
command subcmd1 -h
command subcmd2 -h
command subcmd3 -h
Is there a quick way to tell cli2man to combine the outputs of all these commands into a single manpage? Or would this rather be a case where a seperate manpage for each of the programs should be made and then statet in the see-also section?
thanks and all the best
Jojo
Hi again,
--print-order and --set-order both fail like this:
$ cli2man --print-order
Section Order:
____________________
Traceback (most recent call last):
File "/usr/local/bin/cli2man", line 1243, in <module>
for section in manual.section_order:
NameError: global name 'manual' is not defined
I am using Python 2.7.16 installed via homebrew on macOS 10.13.6
I have the feeling it is looking for:
header:
-section
While info sections probably don't start with a hyphen.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.