Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ sudo mv try /usr/local/bin/
echo 'eval "$(try init ~/src/tries)"' >> ~/.zshrc

# For fish shell users
echo 'eval (try init ~/src/tries | string collect)' >> ~/.config/fish/config.fish
echo 'eval (command try init ~/src/tries | string collect)' >> ~/.config/fish/config.fish
```

### Build from source
Expand Down Expand Up @@ -117,9 +117,9 @@ Not just substring matching - it's smart:
- Fish:

```fish
eval (try init | string collect)
eval (command try init | string collect)
# Or pick a path
eval (try init ~/code/experiments | string collect)
eval (command try init ~/code/experiments | string collect)
```

Notes:
Expand Down
11 changes: 8 additions & 3 deletions src/commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,14 @@ void cmd_init(int argc, char **argv, const char *tries_path) {
// Fish shell version
printf(
"function try\n"
" set -l out (%s exec --path %s $argv 2>/dev/tty)\n"
" or begin; echo $out; return $status; end\n"
" eval $out\n"
" set -l out (%s exec --path %s $argv 2>/dev/tty | string collect)\n"
" set -l rc $pipestatus[1]\n"
" if test $rc -eq 0\n"
" eval $out\n"
" else\n"
" echo $out\n"
" return $rc\n"
" end\n"
"end\n",
zstr_cstr(&escaped_self), zstr_cstr(&escaped_tries));
} else {
Expand Down