This commit is contained in:
iceman1001 2020-04-05 12:49:25 +02:00
commit 2474385ab0
5 changed files with 66 additions and 45 deletions

View file

@ -1,19 +1,31 @@
-- The getopt-functionality is loaded from pm3/getopt.lua
-- Have a look there for further details
getopt = require('getopt')
local getopt = require('getopt')
local ansicolors = require('ansicolors')
copyright = ''
usage = 'script run parameters.lua -a 1 -blala -c -de'
author = 'Martin Holst Swende'
version = 'v1.0.1'
version = 'v1.0.2'
desc = [[
This is an example script to demonstrate handle parameters in scripts.
For more info, check the comments in the code
]]
example = [[
1. script run parameters -a mytestparam_input -c
]]
usage = [[
script run parameters [-h] [-a <txt>] [-b <txt>] [-c] [-d] [-e]
]]
arguments = [[
-h This help
-a <txt> text
-b <txt> text
-c test param w/o input
-d test param w/o input
-e test param w/o input
]]
---
-- Usage help
local function help()
@ -21,9 +33,12 @@ local function help()
print(author)
print(version)
print(desc)
print('Example usage')
print(example)
print(ansicolors.cyan..'Usage'..ansicolors.reset)
print(usage)
print(ansicolors.cyan..'Arguments'..ansicolors.reset)
print(arguments)
print(ansicolors.cyan..'Example usage'..ansicolors.reset)
print(example)
end
local function main(args)