Jump to content

Command line argument handling (again)


Mat
 Share

Recommended Posts

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...