diff --git a/bin/rockspec-generator-cli.lua b/bin/rockspec-generator-cli.lua index 3e91e48..74fac98 100644 --- a/bin/rockspec-generator-cli.lua +++ b/bin/rockspec-generator-cli.lua @@ -1,10 +1,45 @@ local json = require('dkjson') -json.decode(github_event_data) +local basename = 'toto' +local version = '0.1' +local argparse = require('argparse') +local parser = argparse([[rockspec-generator", "LuaRocks "..version..", the Lua package manager\n\n + ' without any arguments to see the configuration.]]) + :help_max_width(80) + :add_help_command() + :add_complete_command({ + help_max_width = 100, + summary = 'Output a shell completion script.', + description = [[ +Output a shell completion script. + +Enabling completions for Bash: + + Add the following line to your ~/.bashrc: + source <(]] .. basename .. [[ completion bash) + or save the completion script to the local completion directory: + ]] .. basename .. [[ completion bash > ~/.local/share/bash-completion/completions/]] .. basename .. [[ +]], + }) + :command_target('command') + :require_command(false) + +parser:flag('--version', 'Show version info and exit.'):action(function() + print('Program version:', version) + os.exit(0) +end) +parser:flag('--dev', 'Enable the sub-repositories in rocks servers for ' .. 'rockspecs of in-development versions.') +parser:option('--template', 'Rockspec-template'):argname('