mpeterv / argparse

Feature-rich command line parser for Lua
MIT License
251 stars 43 forks source link

Command hierarchy should be reflected in the result table #12

Open giann opened 6 years ago

giann commented 6 years ago

If you define a hierarchy of command it should be organized the same way in the result table. It would avoid name collision between command names and argument names of subcommands.

local parser = argparse()
    :name "test"

local mainCommand = parser:command "command"
local subcommand = mainCommand:command "subcommand"
subcommand:argument "arg"
lua cmd.lua command subcommand argument
{
    mainCommand = {
        subcommand = {
             arg = "argument"
        }
    }
}