I'm working on a script for simple spectral data analysis on very big data files. I have a few 'dangerous' but useful argparse positional arguments that I'd like to keep hidden from the -h
or --help
menu. I want these to show only when called by an 'hidden' help command, something like --secrethelp
or whatever. Any idea or hint on how to do this?
Asked
Active
Viewed 38 times
0
-
Sounds similar to the question in the following link: https://stackoverflow.com/questions/11114589/creating-hidden-arguments-with-python-argparse – guru Dec 18 '18 at 18:35
-
see command line arguments [link](https://stackoverflow.com/questions/1009860/how-to-read-process-command-line-arguments) – sahasrara62 Dec 18 '18 at 18:36
-
@prashantrana There's nothing about hidden options there. – Barmar Dec 18 '18 at 18:37
-
1After hiding the options as explained in that question, you can simply add your own `--secrethelp` option that displays a full help, not using the built-in help feature. – Barmar Dec 18 '18 at 18:38
-
@Barmar thanks a lot, this is definitely a solution! i did find the linked question but didn't think about just creating a new option displaying the full help :). Any idea on how to do this in a more 'elegant' way though? – deppep Dec 18 '18 at 18:43
-
Maybe you can do something with the customizable help formatter, but I'm not sure. – Barmar Dec 18 '18 at 18:46
-
Hidden positionals sound dangerous. You'd have to make them `nargs='?'`(or '*'). And having more than one such positional gives more problems. I think hidden optionals make more sense. – hpaulj Dec 18 '18 at 22:48
-
As for the '--secrethelp', I think that would required a lot of your own code, possibly accessing 'private' attributes. There's nothing in `argparse` to override the `help=SUPPRESS`. Either you have to process the `args.secrethelp` attribute after parsing, or make a custom `Action` class. – hpaulj Dec 18 '18 at 22:55