mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:17:35 +00:00
Meta/ShellCompletions: Add toolchain completion
This is very convenient for anyone like me who regularly runs the Clang toolchain. The toolchain is not completed for Lagom and the toolchain-independent help command.
This commit is contained in:
parent
ef7afd8331
commit
418f1f82e7
1 changed files with 16 additions and 0 deletions
|
@ -5,6 +5,7 @@ _serenity() {
|
||||||
args=(
|
args=(
|
||||||
'1:command:->commands'
|
'1:command:->commands'
|
||||||
'2:target:->targets'
|
'2:target:->targets'
|
||||||
|
'3:toolchain:->toolchains'
|
||||||
'*:: :->args'
|
'*:: :->args'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -34,6 +35,12 @@ _serenity() {
|
||||||
'lagom:Target host machine'
|
'lagom:Target host machine'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local toolchains
|
||||||
|
toolchains=(
|
||||||
|
'GNU:Toolchain gcc or $SERENITY_TOOLCHAIN (default)'
|
||||||
|
'Clang:Toolchain clang'
|
||||||
|
)
|
||||||
|
|
||||||
_arguments -C -S "$args[@]"
|
_arguments -C -S "$args[@]"
|
||||||
|
|
||||||
local command
|
local command
|
||||||
|
@ -42,6 +49,9 @@ _serenity() {
|
||||||
local target
|
local target
|
||||||
target="$line[2]"
|
target="$line[2]"
|
||||||
|
|
||||||
|
local toolchain
|
||||||
|
toolchain="$line[3]"
|
||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
commands)
|
commands)
|
||||||
_describe 'command' commands
|
_describe 'command' commands
|
||||||
|
@ -59,6 +69,12 @@ _serenity() {
|
||||||
esac
|
esac
|
||||||
_describe 'target' targets
|
_describe 'target' targets
|
||||||
;;
|
;;
|
||||||
|
toolchains)
|
||||||
|
if [[ "$command" != help && "$target" != lagom ]]; then
|
||||||
|
# Toolchain-dependent invocations.
|
||||||
|
_describe 'toolchain' toolchains
|
||||||
|
fi
|
||||||
|
;;
|
||||||
args)
|
args)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue