Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Erutan409 opened this issue Nov 30, 2017 · 2 comments
Open

Comments

@Erutan409
Copy link

Erutan409 commented Nov 30, 2017

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?

@Bored0ne
Copy link

Bored0ne commented Jan 2, 2018

This is fixed in PR
simply do $command->getTokens() to get an array of tokens sent in
-> #80

@NeoVance
Copy link
Contributor

NeoVance commented Jan 7, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants