mirror of
https://github.com/ovh/the-bastion.git
synced 2024-11-10 17:26:51 +08:00
enh: adminSudo: better autocompletion rules
This commit is contained in:
parent
d1ed88e296
commit
e2a64a9d8f
2 changed files with 10 additions and 1 deletions
|
@ -3,6 +3,8 @@
|
||||||
"adminSudo" , { "ac" : ["-- --sudo-as"]},
|
"adminSudo" , { "ac" : ["-- --sudo-as"]},
|
||||||
"adminSudo -- --sudo-as" , { "ac" : ["<ACCOUNT>" ]},
|
"adminSudo -- --sudo-as" , { "ac" : ["<ACCOUNT>" ]},
|
||||||
"adminSudo -- --sudo-as \\S+" , { "ac" : ["--sudo-cmd" ]},
|
"adminSudo -- --sudo-as \\S+" , { "ac" : ["--sudo-cmd" ]},
|
||||||
"adminSudo -- --sudo-as \\S+ --sudo-cmd" , { "pr" : ["<PLUGIN> -- <ARG1> <ARG2>" ]}
|
"adminSudo -- --sudo-as \\S+ --sudo-cmd" , { "ac" : ["<COMMAND>" ]},
|
||||||
|
"adminSudo -- --sudo-as \\S+ --sudo-cmd \\S+" , { "ac" : ["--" ]},
|
||||||
|
"adminSudo -- --sudo-as \\S+ --sudo-cmd \\S+ --" , { "pr" : ["<enter> or additional COMMAND-specific options" ]}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,6 +149,13 @@ EOM
|
||||||
next;
|
next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elsif ($_ eq '<COMMAND>') {
|
||||||
|
my $fnret = OVH::Bastion::get_plugin_list();
|
||||||
|
if ($fnret) {
|
||||||
|
push @autocomplete, sort keys %{$fnret->value()};
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
}
|
||||||
push @autocomplete, $_;
|
push @autocomplete, $_;
|
||||||
}
|
}
|
||||||
return @autocomplete;
|
return @autocomplete;
|
||||||
|
|
Loading…
Reference in a new issue