Skip to content

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

@Shelim

Description

@Shelim

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions