mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
Revert "cleanup: simplify option matching function"
This reverts commit 0396ade38b
.
The original code also handled len==1, which the new code doesn't.
Press <TAB> in the lvm shell to get a list of the possible
flag completions for a single hyphen.
This commit is contained in:
parent
c363c74a25
commit
9495a3d807
17
tools/lvm.c
17
tools/lvm.c
@ -91,11 +91,18 @@ static char *_list_args(const char *text, int state)
|
||||
return NULL;
|
||||
|
||||
/* Short form arguments */
|
||||
if (len == 2 && text[0] == '-') {
|
||||
while (match_no < com->num_args)
|
||||
if (text[1] == (_cmdline->arg_props +
|
||||
com->valid_args[match_no++])->short_arg)
|
||||
return strdup(text);
|
||||
if (len < 3) {
|
||||
while (match_no < com->num_args) {
|
||||
char s[3];
|
||||
char c;
|
||||
if (!(c = (_cmdline->arg_props +
|
||||
com->valid_args[match_no++])->short_arg))
|
||||
continue;
|
||||
|
||||
sprintf(s, "-%c", c);
|
||||
if (!strncmp(text, s, len))
|
||||
return strdup(s);
|
||||
}
|
||||
}
|
||||
|
||||
/* Long form arguments */
|
||||
|
Loading…
Reference in New Issue
Block a user