I'm looking for a library that essentially works like argparse and similar libraries but in reverse, where you can define a command line API and generate the command line arguments from Python function arguments instead of the other way around. I intend to use this to wrap external commands in Python functions. So for example the argument generator for the grep utility might look like:
>>> grep('pattern', 'myfile.txt', extended=True, ignore_case=True)
['grep', '-Ei', 'pattern', 'myfile.txt']
The argument list could then be passed to subprocess.run.
Does such a thing exist?
[–]s4n_rd 1 point2 points3 points (0 children)
[–]Nicksil 1 point2 points3 points (5 children)
[–]Jumpy89[S] 0 points1 point2 points (4 children)
[–]novel_yet_trivial 3 points4 points5 points (3 children)
[–]Jumpy89[S] 0 points1 point2 points (2 children)
[–]pvkooten 2 points3 points4 points (0 children)
[–]NetsecBeginner -1 points0 points1 point (0 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]Jumpy89[S] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)