Debian Codegraph @

texmf-dist/doc/support/lua-alt-getopt/alt_getopt

raw
1 #!/usr/bin/env lua
2
3 require "alt_getopt"
4
5 local long_opts = {
6 verbose = "v",
7 help = "h",
8 fake = 0,
9 len = 1,
10 output = "o",
11 set_value = "S",
12 ["set-output"] = "o"
13 }
14
15 local ret
16 local optarg
17 local optind
18 opts,optind,optarg = alt_getopt.get_ordered_opts (arg, "hVvo:n:S:", long_opts)
19 for i,v in ipairs (opts) do
20 if optarg [i] then
21 io.write ("option `" .. v .. "': " .. optarg [i] .. "\n")
22 else
23 io.write ("option `" .. v .. "'\n")
24 end
25 end
26
27 optarg,optind = alt_getopt.get_opts (arg, "hVvo:n:S:", long_opts)
28 for k,v in pairs (optarg) do
29 io.write ("fin-option `" .. k .. "': " .. v .. "\n")
30 end
31
32 for i = optind,#arg do
33 io.write (string.format ("ARGV [%s] = %s\n", i, arg [i]))
34 end