Sign in to follow this  
Followers 0
Mat

Command line argument handling (again)

1 post in this topic

My old version is >here. This is a complete rewrite, though is mostly backwards compatible.

CmdLine.au3: http://gist.github.com/MattDiesel/5759477

Example (uses _CmdLine_Process for convenience): 

#include "CmdLine.au3"

_CmdLine_UseDefaults()
_CmdLine_StrictMode(True)

_CmdLine_Register("hello", "h", $CLF_HASPARAM + $CLF_PARAMOPTIONAL, "Says hello to someone", _
        "This function prints a message that says hello to `WHO`, and then exits.", "WHO", "World", "_Hello")

_CmdLine_Process("--hello")
ConsoleWrite("----" & @LF)
_CmdLine_Process("-h Matt")
ConsoleWrite("----" & @LF)
_CmdLine_Process("--help --hello")

Func _Hello($who)
    ConsoleWrite(StringFormat("Hello, %s!\n", $who))
EndFunc   ;==>_Hello

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0