Benoït has an excellent explanation on using gb.args in this thread:
http://gambas.8142.n7.nabble.com/New-co ... 31829.html
However, my mind is wrapped around the way command line arguments are used in most Ruby libraries. Simply because I am used to it, I use gb.Args in a different way, and it works. Now whenever I am swimming against the flow, I am wondering whether I am doing the right thing. Any comments from the experienced coders on this?
Code: Select all
Public Sub Main()
Dim strTemp As String
If Args.Count > 1
For Each strTemp In Args
Select strTemp
Case "--help"
DisplayHelp()
Case "--version"
DisplayVersion()
Case "--tmux"
ExecTmuxStartTranslate()
Case "--chdir"
HandleChdir()
Case "--term"
CatFileGrep(strTerminologyFile)
Case "--trans"
CatFileGrep(strTranslateFile)
Case "--test" ' for running arbitrary testing code
DoTest()
Case Else
Print "Unknown parameter: " & strTemp
End Select
Next
Else
Print "No parameters provided" ' this is useful to run the prog within the IDE to find syntax errors before compiling an executable to be executed in a shell
Endif
End