diff options
| author | Mike Vink <mike@pionative.com> | 2025-02-03 21:29:42 +0100 |
|---|---|---|
| committer | Mike Vink <mike@pionative.com> | 2025-02-03 21:29:42 +0100 |
| commit | 5155816b7b925dec5d5feb1568b1d7ceb00938b9 (patch) | |
| tree | deca28ea15e79f6f804c3d90d2ba757881638af5 /spec/fixtures/legacyexternalcommand.lua | |
Diffstat (limited to 'spec/fixtures/legacyexternalcommand.lua')
| -rw-r--r-- | spec/fixtures/legacyexternalcommand.lua | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/spec/fixtures/legacyexternalcommand.lua b/spec/fixtures/legacyexternalcommand.lua new file mode 100644 index 0000000..af57537 --- /dev/null +++ b/spec/fixtures/legacyexternalcommand.lua @@ -0,0 +1,34 @@ + +--- Module implementing an external command with legacy arg parsing. +local legacyexternalcommand = {} + +local util = require("luarocks.util") + +legacyexternalcommand.help_summary = "generate legacyexternalcommand package files of a rock." +legacyexternalcommand.help_arguments = "arg1 [arg2]" +legacyexternalcommand.help = [[ +This addon generates legacyexternalcommand package files of a rock. +First argument is the name of a rock, the second argument is optional +and needed when legacyexternalcommand uses another name (usually prefixed by lua-). +Files are generated with the source content of the rock and more +especially the rockspec. So, the rock is downloaded and unpacked. +]] + +--- Driver function for the "legacyexternalcommand" command. +-- @param arg1 string: arg1. +-- @param arg2 string: arg2 (optional) +-- @return boolean: true if successful +function legacyexternalcommand.command(flags, arg1, arg2) + if type(arg1) ~= 'string' then + return nil, "Argument missing. "..util.see_help('legacyexternalcommand') + end + + for k,v in pairs(flags) do + print("FLAGS", k,v) + end + print("ARG1", tostring(arg1)) + print("ARG2", tostring(arg2)) + return true +end + +return legacyexternalcommand |
