Command line argument when starting the CLI #1175
-
I would like to pass a command line argument to my CLI when starting it - the IP address of the server to connect to. Something like this (running in Windows PowerShell):
In the main loop, I have some code to grab the argument before even starting the command parser:
But when I run this, I get an error:
How do I pass the IP address like this and have the command parser ignore it? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
|
Beta Was this translation helpful? Give feedback.
cmd2.Cmd.__init__
has a slightly misleading parameter calledallow_cli_args
. You need to set that toFalse
if you are processing your own command line args.