-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
297 additions
and
237 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
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use crate::shell_install::ShellFamily; | ||
|
||
pub const BASH: ShellFamily<'static> = ShellFamily { | ||
name: "bash", | ||
sourcing_files: &[".bashrc", ".zshrc"], | ||
version: 1, | ||
script: BASH_FUNC | ||
}; | ||
|
||
// This script has been tested on bash and zsh. | ||
// It's installed under the bash name (~/.config/broot | ||
// but linked from both the .bashrc and the .zshrc files | ||
const BASH_FUNC: &str = r#" | ||
# This script was automatically generated by the broot function | ||
# More information can be found in https://github.com/Canop/broot/blob/master/documentation.md | ||
# 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 { | ||
f=$(mktemp) | ||
( | ||
set +e | ||
broot --outcmd "$f" "$@" | ||
code=$? | ||
if [ "$code" != 0 ]; then | ||
rm -f "$f" | ||
exit "$code" | ||
fi | ||
) | ||
code=$? | ||
if [ "$code" != 0 ]; then | ||
return "$code" | ||
fi | ||
d=$(cat "$f") | ||
rm -f "$f" | ||
eval "$d" | ||
} | ||
"#; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::shell_install::ShellFamily; | ||
|
||
pub const FISH: ShellFamily<'static> = ShellFamily { | ||
name: "fish", | ||
sourcing_files: &[".config/fish/config.fish"], // idealy we should probably use XDG here... | ||
version: 1, | ||
script: FISH_FUNC | ||
}; | ||
|
||
const FISH_FUNC: &str = r#" | ||
# This script was automatically generated by the broot function | ||
# More information can be found in https://github.com/Canop/broot/blob/master/documentation.md | ||
# 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 | ||
set f (mktemp) | ||
broot --outcmd $f $argv | ||
if test $status -ne 0 | ||
rm -f "$f" | ||
return "$code" | ||
end | ||
set d (cat "$f") | ||
rm -f "$f" | ||
eval "$d" | ||
end | ||
"#; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.