Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python CLI tool - general parsing question

If possible I would like to use the following structure for a command however I can't seem to figure out how to achieve this in Python:

./somescript.py arg <optional argument> -- "some long argument"

Would it be possible to achieve this in a feasible manner without too much dirty code? Or should I just reconsider the syntax (which is primarily preference).

Thanks!

like image 795
WinkyWolly Avatar asked Feb 28 '26 10:02

WinkyWolly


1 Answers

I think optparse can do this.

like image 151
ʇsәɹoɈ Avatar answered Mar 02 '26 00:03

ʇsәɹoɈ



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!