[LU-12734] bash completion (for now: lctl set/get_param) Created: 09/Sep/19 Updated: 13/Dec/22 Resolved: 20/Sep/19 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.13.0 |
| Type: | New Feature | Priority: | Minor |
| Reporter: | CEA | Assignee: | Dominique Martinet (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | LTS12 | ||
| Issue Links: |
|
||||||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||||||
| Description |
|
Fairly far from lustre itself... Being used to tabbing into /proc/fs/lustre, with many files moving to various subdirectories of /sys the lctl set/get_param commands are really hard to use for me without completion. I wrote bash completion for the *_param commands only to start with, will push to gerrit what I have right away. Questions:
I personally don't care much - definitely won't help with other shell completions but I'd be happy to (slowly) add up other commands and update once in a while; the most critical for me really is set/get_param completion and I've set that up in our configuration management system so this is mostly freebies / possibly call for help to finish. |
| Comments |
| Comment by Gerrit Updater [ 09/Sep/19 ] |
|
Dominique Martinet (dominique.martinet@cea.fr) uploaded a new patch: https://review.whamcloud.com/36105 |
| Comment by Peter Jones [ 09/Sep/19 ] |
|
There was enthusiastic response to this idea on the triage call today |
| Comment by Andreas Dilger [ 09/Sep/19 ] |
|
IMHO, I think your initial patch is already very useful and worthwhile to land. This is something that I've wanted for a long time. I think implementing this incrementally is definitely the right way to do it. Trying to do a "full" implementation for all commands would take a lot of time and be of marginal use, since many lctl commands are rarely used. The get/set/list params have by far the most optional arguments, so users need the most help with those. Also, getting the initial functionality out to users could encourage contributions from others. Having bash completions for "lfs setstripe" would probably be my suggestion for the next thing to tackle. As for completions for other shells, I think that can be left for users who care more about them. Bash is by far the most common shell, and should get the most attention. |
| Comment by Gerrit Updater [ 20/Sep/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36105/ |
| Comment by Peter Jones [ 20/Sep/19 ] |
|
Landed for 2.13 |
| Comment by Gerrit Updater [ 15/Oct/19 ] |
|
Andreas Dilger (adilger@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36459 |
| Comment by Andreas Dilger [ 15/Oct/19 ] |
|
Dominique, I tried to install the lctl bash completion on an older client (with bash-completion-1.3), and it failed with an error "bash _init_completion: command not found". By looking at the existing helpers installed on that system, I found that replacing _init_completion with _get_comp_words_by_ref allowed the completions to work. It looks like the "_get_comp_words_by_ref()" function is also available in newer versions of bash_completion (at least bash-completion-2.1 uses it internally to _init_completions()). It seems to work in my light testing, but I don't know the details of what is being missed by not using _init_completions(). Do you know if that is critical? PS: this functionality is quite awesome. It even works properly with things like "osc.myth-*.max<tab>" to provide the "short" list of completions rather than expanding "*" to the full list. |
| Comment by Gerrit Updater [ 18/Oct/19 ] |
|
Minh Diep (mdiep@whamcloud.com) uploaded a new patch: https://review.whamcloud.com/36483 |
| Comment by Gerrit Updater [ 05/Nov/19 ] |
|
Andreas Dilger (adilger@whamcloud.com) merged in patch https://review.whamcloud.com/36459/ |
| Comment by Gerrit Updater [ 21/Nov/19 ] |
|
Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/36483/ |