From a68888d55f3525c078c74e8b2f75ea8e3e4a4b7f Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser hiddenalpha.ch Date: Tue, 13 Dec 2022 20:40:30 +0100 Subject: Small Cleanup --- src/bash/_bashrc | 6 +++--- src/file-templates/scriptlee.lua | 20 +++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/bash/_bashrc b/src/bash/_bashrc index df0c285..af3ee3e 100644 --- a/src/bash/_bashrc +++ b/src/bash/_bashrc @@ -1,7 +1,7 @@ -WINDOOF=$(if test -d /c/Windows; then echo true; else echo false; fi) +WINDOOF=$(if [ -d /c/Windows ]; then echo true; else echo false; fi) -if test -d ~/.bin ; then +if [ -d ~/.bin ]; then PATH=~/.bin:$PATH fi @@ -33,7 +33,7 @@ if $WINDOOF; then # Fix vim-behind-ssh on windoof # TODO this fixes the remote shell, but breaks the local one (Eg del prints # tilde). Grr .... - #if test -n "$ConEmuBuild"; then TERM=dumb; export TERM; fi + #if [ -n "$ConEmuBuild" ]; then TERM=dumb; export TERM; fi fi diff --git a/src/file-templates/scriptlee.lua b/src/file-templates/scriptlee.lua index ac46bbb..75da940 100644 --- a/src/file-templates/scriptlee.lua +++ b/src/file-templates/scriptlee.lua @@ -19,18 +19,20 @@ function mod.printHelp() end -function mod.parseArgs( this ) +function mod.parseArgs( app ) local positionalArgNr = 0 - for iA=1, #_ENV.arg do + local iA = 0 + while true do iA = iA +1 local arg = _ENV.arg[iA] - if false then + if not arg then + break elseif arg == "--help" then mod.printHelp() return -1 elseif not arg:find("^%-%-") then positionalArgNr = positionalArgNr + 1 if false then --elseif positionalArgNr == 1 then - -- this.whatever = arg + -- app.whatever = arg else log:write("Unexpected arg: ".. arg .."\n")return -1 end @@ -38,22 +40,22 @@ function mod.parseArgs( this ) log:write("Unexpected arg: ".. arg .."\n")return -1 end end - if not this.whatever then log:write("TODO write errmsg here\n")return -1 end + if not app.whatever then log:write("TODO write errmsg here\n")return -1 end return 0 end -function mod.run( this ) +function mod.run( app ) log:write("[INFO ] TODO impl what the prog should do\n") end function mod.main() - local this = objectSeal{ + local app = objectSeal{ whatever = false, } - if mod.parseArgs(this) ~= 0 then os.exit(1) end - mod.run(this) + if mod.parseArgs(app) ~= 0 then os.exit(1) end + mod.run(app) end -- cgit v1.1