aboutsummaryrefslogtreecommitdiffstats
path: root/etc/profile-m-z
diff options
context:
space:
mode:
authorLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2022-10-18 17:10:10 -0300
committerLibravatar Kelvin M. Klann <kmk3.code@protonmail.com>2022-10-22 00:09:39 -0300
commitc648adc9a6e2f50e3b742d2f71a148e9f9e41c89 (patch)
treed5366a53a087f7631a237bdff3ae7a12fbb1501e /etc/profile-m-z
parentsort.py: print usage if there are no arguments (diff)
downloadfirejail-c648adc9a6e2f50e3b742d2f71a148e9f9e41c89.tar.gz
firejail-c648adc9a6e2f50e3b742d2f71a148e9f9e41c89.tar.zst
firejail-c648adc9a6e2f50e3b742d2f71a148e9f9e41c89.zip
sort.py: use script name in usage/main docstring
With this, the help section remains consistent regardless of how the script is called and even if the filename is changed. For example, if someone renames "sort.py" to "firejail-sort" and puts it somewhere in `$PATH`. Example outputs of the script name (using `print(argv[0]); return`): $ ./contrib/sort.py ./contrib/sort.py $ python contrib/sort.sh contrib/sort.py $ (cd contrib && ./sort.py) ./sort.py Note: This depends on `os.path` and `sys.argv`, so the imports have to appear before the docstring. In which case, the docstring has to be explicitly assigned to `__doc__` (as it ceases to be the first statement in the file). Note2: When running `pydoc ./contrib/sort.py`, `argv[0]` becomes "/usr/bin/pydoc" (using python 3.10.8-1 on Artix Linux).
Diffstat (limited to 'etc/profile-m-z')
0 files changed, 0 insertions, 0 deletions