Skip to content

Commit

Permalink
Fix fish shell integrations
Browse files Browse the repository at this point in the history
I was confused about how the command substitution worked, in terms of parsing output. With bash and other shells, it'll split on whitespace, but in fish it only splits on newlines. As documented, use `string split -n " "` instead.

>Unlike other shells, fish does not split command substitutions on any whitespace (like spaces or tabs), only newlines. This can be an issue with commands like pkg-config that print what is meant to be multiple arguments on a single line. To split it on spaces too, use string split.

https://fishshell.com/docs/current/tutorial.html#command-substitutions
Signed-off-by: Daniel Mikusa <[email protected]>
  • Loading branch information
Daniel Mikusa committed Feb 14, 2022
1 parent fd5ae77 commit c3d8ecb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/scripts/fish.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function docker;
set DOCKER (which docker);
if test "$argv[1]" = "run";
bt args -d | xargs -I{} $DOCKER run {} $argv[2..];
$DOCKER run (bt args -d | string split -n ' ') $argv[2..];
else;
$DOCKER $argv[1..];
end;
Expand All @@ -10,7 +10,7 @@ end;
function pack;
set PACK (which pack);
if test "$argv[1]" = "build";
bt args -p | xargs $PACK build $argv[2..];
$PACK build $argv[2..] (bt args -p | string split -n ' ');
else;
$PACK $argv[1..];
end;
Expand Down

0 comments on commit c3d8ecb

Please sign in to comment.