commando icon indicating copy to clipboard operation
commando copied to clipboard

How do I determine when a flag is actually passed into the cmd session?

Open Erutan409 opened this issue 8 years ago • 2 comments

I know I must be missing something here, but what is the actual process of determining when a predefined flag is passed into the script endpoint? I've resorted to writing my own function to parse the $_SERVER['argc'] array.

Pretty sure the library is supposed to be taking care of this for me already, right?

Erutan409 avatar Nov 30 '17 15:11 Erutan409

This is fixed in PR simply do $command->getTokens() to get an array of tokens sent in -> https://github.com/nategood/commando/pull/80

Bored0ne avatar Jan 02 '18 17:01 Bored0ne

Sorry for the late response.

The commando instance contains the token values once they have been parsed by commando. you can use the parse function manually, or kick of the parsing by accessing the object like an array using the option or argument name as the key like so: $opValue = $command[$opName];

There are also a few useful functions for this like getArguments, getFlags, and getOptions that can be used. All of those functions will also force the token list to be parsed by Commando if it has not already done so.

NeoVance avatar Jan 07 '18 08:01 NeoVance