diff options
| author | bozo.kopic <bozo@kopic.xyz> | 2022-05-26 20:23:02 +0200 |
|---|---|---|
| committer | bozo.kopic <bozo@kopic.xyz> | 2022-05-26 20:23:02 +0200 |
| commit | cbba80700cbdc95d294f3ec61075ff2cbdd503e3 (patch) | |
| tree | 98d4561d227cebf5b207cdd0c622444600134849 /shell/zsh/broot.zsh | |
| parent | 38da1893e95fa4438f01a67c5ebb180b21548bc1 (diff) | |
.
Diffstat (limited to 'shell/zsh/broot.zsh')
| -rw-r--r-- | shell/zsh/broot.zsh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/shell/zsh/broot.zsh b/shell/zsh/broot.zsh new file mode 100644 index 0000000..44cee96 --- /dev/null +++ b/shell/zsh/broot.zsh @@ -0,0 +1,21 @@ + +# This script was automatically generated by the broot program +# More information can be found in https://github.com/Canop/broot +# This function starts broot and executes the command +# it produces, if any. +# It's needed because some shell commands, like `cd`, +# have no useful effect if executed in a subshell. +function br { + local cmd cmd_file code + cmd_file=$(mktemp) + if broot --outcmd "$cmd_file" "$@"; then + cmd=$(<"$cmd_file") + rm -f "$cmd_file" + eval "$cmd" + else + code=$? + rm -f "$cmd_file" + return "$code" + fi +} + |
