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

Default input handler without specifying a command #70

Closed
wangxuw opened this issue Jun 29, 2020 · 4 comments
Closed

Default input handler without specifying a command #70

wangxuw opened this issue Jun 29, 2020 · 4 comments

Comments

@wangxuw
Copy link

wangxuw commented Jun 29, 2020

Like the switch grammar, how about register a default handler for input?
For example: just input three integers after the prompt, and then call the Add command by default.

cli> 1 2 3
6
cli>

It would be nice when a single command is massively used.

BTW, cli now supports Insert a command name of std::string(""), but it seems this command would never be called.

@daniele77
Copy link
Owner

Since the library uses the first token of the input to lookup a command list, I could add a default handler to manage the cases where the command is unknown or wrong. However, this would comprise also the errors in the types of command parameters.
I'm not quite sure this would constitute a useful feature, however.

@wangxuw
Copy link
Author

wangxuw commented Jul 3, 2020

Yes, of course. It would also be conflict with some commands. e.g: command 1 in aforementioned example.

I think the Insert of command std::string("") should be disabled since it is never called.

BTW, it is somewhat weird when paste something to runtime cli using ctrl-v, the whole content would not echo until a next keyboard is triggered.

std::pair<KeyType,char> Get()

should here be modified to echo pasted content?

@daniele77
Copy link
Owner

Ok, @EFS86340 .
So this issue should be actually split into three:

  1. custom default input handler
  2. do not allow the insertion of empty command in a menu (i.e., "")
  3. missing echo after ctrl-v paste of command

Can you open the issue 2) and 3) please? So that we can continue the discussion of each problem the in the appropriate place :-)

Thank you

@wangxuw
Copy link
Author

wangxuw commented Jul 3, 2020

Sure, so I would close this issue now.

@wangxuw wangxuw closed this as completed Jul 3, 2020
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

2 participants