Page MenuHomePhabricator

Autocomplete
Closed, ResolvedPublicFeature

Description

Feature summary (what you would like to be able to do and where): I wish mwcli provides autocompleting commands by pressing the tab key.

Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution): There are a few commands in mwcli, but I mainly use limited commands, as mw dev mediawiki create or mw dev mysql destroy.

Benefits (why should this be implemented?): If autocompletion is provided, users and I could reduce the number of typing.

Event Timeline

Addshore triaged this task as Medium priority.Oct 9 2021, 12:26 AM

This should be fairly easy as I imagine cobra has tooling to enable this either out of the box or with another easy to use library / package.

It also would be discussed how to install the autocomplete, as the cli itself can be installed by, a very simple installation method, downloading the binary.

Option 1) Introduce a more complex installation script.
Option 2) Some go software provides a sort of install-autocomplete command. https://www.terraform.io/docs/cli/commands/index.html#shell-tab-completion Provide it.

Addshore lowered the priority of this task from Medium to Low.Oct 17 2021, 7:34 PM
Addshore closed this task as Resolved.EditedJan 27 2022, 6:30 PM
Addshore claimed this task.

This is possible

mw completion > completion
sudo mv completion /etc/bash_completion.d/mw
# OR
mv completion /usr/share/bash-completion/completions/mw

So closing this, but also happy to try and make this auto generated completion better!
For bash it looks something like this

image.png (703×2 px, 135 KB)