Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: reverse formatting of given table back into command line args #19

Open
Shelim opened this issue Apr 2, 2021 · 0 comments

Comments

@Shelim
Copy link

Shelim commented Apr 2, 2021

First of all - thank you for this tool and your awesome work on it.

I wonder if there is a possibility to do reverse formatting (parsing) of given table back into command line args using the same parser definition. I could not find that information in tutorial nor docs, so I assume it is unimplemented now. If I am mistaken, please point me in the right direction.

If it is indeed not implemented, I can work on some PR myself

The feature itself - for example if given:

local parser = argparse("script", "An example.")
parser:argument("input", "Input file.")
parser:option("-o --output", "Output file.", "a.out")
parser:option("-I --include", "Include locations."):count("*")

And:

{
   input = "foo",
   output = "bar",
   include = {"/usr/local/include", "src"}
}

It should produce the (possibly customizable) result of:

foo -o bar -I/usr/local/include -Isrc

Usage case:

System Administrator may use interactive Lua shell script to construct complex command to be executed. After they are done with setting all parameters they might be presented with non-interactive command line equivalent query to be used next time instead of going through the complicated script wizard again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant