- in Win cmd there is no options handling att all
- in linux there is a native handling but could be easier
- parse options text file
- evaluate CLI arguments
- generate temporary cmd / sh content
- write options text which can also be used as help output
- add options just with a new line in text
value option
^ *-[a-zA-Z] +<\w[\w ]*>
simple switch
^ *-[a-zA-Z] +
options:
-c generate coverage
-o <file> output to file
-t write todo
-H create HTML
-h this help
SETLOCAL
docopts.exe options.txt %* > tmp.cmd
call tmp.cmd
with arguments -Hto wumpel.dat file1 file2
tmp.cmd
set _Hu=1==1
set _c=0==1
set _h=0==1
set _t=1==1
set _o=wumpel.dat
set _args=file1 file2
Since win cmd variables are not case sensitive upper case options are indicated by u.
docopts options.txt $* > tmp.sh
source tmp.sh
with arguments -Hto wumpel.dat file1 file2
tmp.sh
export _H=true
export _c=false
export _h=false
export _t=true
export _o=wumpel.dat
export _args="file1 file2 "
for sample scripts see shell folder