Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Partial command parse #1325

Unanswered
Sripadvallabh asked this question in Q&A
Sep 18, 2024 · 1 comments · 5 replies
Discussion options

Hi folks,

I have 3 commands in my cmd2 application: namely device, start, stop. Is it possible for me to invoke do_device() just by pressing 'd' alone because from all the possible cmd list it seems only 'device' matches so it should be able to invoke the same right? Is there a setting that can enable this???

Alias is a fine solution to this problem, but i am thinking if this auto command match works with cmd2.

You must be logged in to vote

Replies: 1 comment 5 replies

Comment options

I don't recall if it's covered in our tests or is still functional, but this plug-in exists.
https://github.com/python-cmd2/cmd2-abbrev

You must be logged in to vote
5 replies
Comment options

thanks for calling it out

Comment options

Traceback (most recent call last):
 File "laut.py", line 2149, in <module>
 deviceShell = lautShell()
 File "laut.py", line 60, in __init__
 super().__init__(*args, **kwargs)
 File "/nobackup/araradha/pyats/lib/python3.8/site-packages/cmd2_abbrev/abbrev.py", line 17, in __init__
 self.add_settable(cmd2.Settable('abbrev', bool, 'Accept command abbreviations'))
TypeError: __init__() missing 1 required positional argument: 'settable_object'
Comment options

Getting above error

Comment options

i see that add_settable() has a different signature now. So is there any way the plugin could work??

Comment options

@Sripadvallabh Feel free to submit a PR to fix the cmd2-abbrev extension for the updated settable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /