mirror of
https://github.com/token2/snapd.git
synced 2026-03-13 11:15:47 -07:00
Snapd installs bash completion files from snaps in `/usr/share/bash-completion/completions` which in some distributions is a read-only filesystem. Instead of installing them in `/usr` we can install them within `/var/lib/snapd` which should always be writable. Because `/var/lib/snapd/desktop` is already in `XDG_DATA_DIRS`, we can save the files there. Because bash-completion 2.1 and prior do not support `XDG_DATA_DIRS`, on older distributions, the legacy path `/usr/share/bash-completion/completions` will still be used.
22 lines
745 B
Plaintext
22 lines
745 B
Plaintext
source "$::env(SPREAD_PATH)/$::env(SPREAD_SUITE)/lib.exp0"
|
|
send "source $::env(SPREAD_PATH)/$::env(SPREAD_SUITE)/$::env(SPREAD_VARIANT).sh\n"
|
|
next
|
|
send "source /usr/share/bash-completion/bash_completion\n"
|
|
next
|
|
if {$::env(_COMPLETE_SH)} {
|
|
# because this sources complete.sh, it won't be using the snippets
|
|
send "source $::env(SPREAD_PATH)/data/completion/bash/complete.sh\n"
|
|
next
|
|
}
|
|
chat "$::env(CMD) \t\t" $::env(_OUT0)
|
|
cancel
|
|
# completion when the cursor is not at the end of the line:
|
|
set back1 [string repeat "\b" [string length $::env(_KEY1)]]
|
|
chat "$::env(CMD) $::env(_KEY1)$back1\t\t" $::env(_OUT0)
|
|
cancel
|
|
chat "$::env(CMD) $::env(_KEY1)\t" $::env(_OUT1)
|
|
cancel
|
|
chat "$::env(CMD) $::env(_KEY2)\t\t" $::env(_OUT2)
|
|
cancel
|
|
brexit
|