-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
installShellFiles: ensure shell completion has more than 256 bytes
I found an error in the completion script of tmuxp which were outputting an error message instead of a proper script so a sanity check in the installShellCompletion script is helpful to avoid this to happen in the future. After looking at possible ways to detect this, the only valid check I found was based on the generated file size as any completion script I could find had more than 256 bytes. Signed-off-by: Otavio Salvador <[email protected]>
- Loading branch information
Showing
2 changed files
with
24 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ recurseIntoAttrs { | |
echo qux > qux.zsh | ||
echo quux > quux | ||
installShellCompletion --bash foo bar --zsh baz qux.zsh --fish quux | ||
installShellCompletion --size-check 4 --bash foo bar --zsh baz qux.zsh --fish quux | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
otavio
Author
Contributor
|
||
cmp foo $out/share/bash-completion/completions/foo | ||
cmp bar $out/share/bash-completion/completions/bar | ||
|
@@ -68,7 +68,7 @@ recurseIntoAttrs { | |
} '' | ||
echo foo > foo | ||
installShellCompletion --bash foo | ||
installShellCompletion --size-check 4 --bash foo | ||
# assert it didn't go into $out | ||
[[ ! -f $out/share/bash-completion/completions/foo ]] | ||
|
@@ -82,7 +82,7 @@ recurseIntoAttrs { | |
echo bar > bar | ||
echo baz > baz | ||
installShellCompletion --bash --name foobar.bash foo --zsh --name _foobar bar --fish baz | ||
installShellCompletion --size-check 4 --bash --name foobar.bash foo --zsh --name _foobar bar --fish baz | ||
cmp foo $out/share/bash-completion/completions/foobar.bash | ||
cmp bar $out/share/zsh/site-functions/_foobar | ||
|
@@ -93,7 +93,7 @@ recurseIntoAttrs { | |
echo bar > bar.zsh | ||
echo baz > baz.fish | ||
installShellCompletion foo.bash bar.zsh baz.fish | ||
installShellCompletion --size-check 4 foo.bash bar.zsh baz.fish | ||
cmp foo.bash $out/share/bash-completion/completions/foo.bash | ||
cmp bar.zsh $out/share/zsh/site-functions/_bar | ||
|
@@ -105,7 +105,7 @@ recurseIntoAttrs { | |
echo baz > baz.fish | ||
echo qux > qux.fish | ||
installShellCompletion --cmd foobar --bash foo.bash --zsh bar.zsh --fish baz.fish --name qux qux.fish | ||
installShellCompletion --size-check 4 --cmd foobar --bash foo.bash --zsh bar.zsh --fish baz.fish --name qux qux.fish | ||
cmp foo.bash $out/share/bash-completion/completions/foobar.bash | ||
cmp bar.zsh $out/share/zsh/site-functions/_foobar | ||
|
@@ -114,6 +114,7 @@ recurseIntoAttrs { | |
''; | ||
install-completion-fifo = runTest "install-completion-fifo" {} '' | ||
installShellCompletion \ | ||
--size-check 4 \ | ||
--bash --name foo.bash <(echo foo) \ | ||
--zsh --name _foo <(echo bar) \ | ||
--fish --name foo.fish <(echo baz) | ||
|
I think that stuff like this should be moved to that terraform commit and then change the name of that commit to a treewide.
nixpkgs-review is the whole afternoon already doing nix log in the derivations lol