-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from jdelStrother/fish
- Loading branch information
Showing
14 changed files
with
279 additions
and
80 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
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,25 @@ | ||
# Based on https://github.com/arbelt/fish-plugin-scmpuff, | ||
# with scmpuff-exec support (https://github.com/mroth/scmpuff/pull/49) | ||
functions -e git | ||
|
||
set -q SCMPUFF_GIT_CMD; or set -x SCMPUFF_GIT_CMD (which git) | ||
|
||
function git | ||
if test (count $argv) -eq 0 | ||
eval $SCMPUFF_GIT_CMD | ||
set -l s $status | ||
return $s | ||
end | ||
|
||
switch $argv[1] | ||
case commit blame log rebase merge | ||
scmpuff exec -- "$SCMPUFF_GIT_CMD" $argv | ||
case checkout diff rm reset restore | ||
scmpuff exec --relative -- "$SCMPUFF_GIT_CMD" $argv | ||
case add | ||
scmpuff exec -- "$SCMPUFF_GIT_CMD" $argv | ||
scmpuff_status | ||
case '*' | ||
eval command "$SCMPUFF_GIT_CMD" (string escape -- $argv) | ||
end | ||
end |
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,32 @@ | ||
# Based on https://github.com/arbelt/fish-plugin-scmpuff, | ||
# with fish3 fix https://github.com/arbelt/fish-plugin-scmpuff/pull/3 | ||
function scmpuff_status | ||
scmpuff_clear_vars | ||
set -lx scmpuff_env_char "e" | ||
set -l cmd_output (/usr/bin/env scmpuff status --filelist $argv) | ||
set -l es "$status" | ||
|
||
if test $es -ne 0 | ||
return $es | ||
end | ||
|
||
set -l files (string split \t $cmd_output[1]) | ||
if test (count $files) -gt 0 | ||
for e in (seq (count $files)) | ||
set -gx "$scmpuff_env_char""$e" "$files[$e]" | ||
end | ||
end | ||
|
||
for line in $cmd_output[2..-1] | ||
echo $line | ||
end | ||
end | ||
|
||
function scmpuff_clear_vars | ||
set -l scmpuff_env_char "e" | ||
set -l scmpuff_env_vars (set -x | awk '{print $1}' | grep -E '^'$scmpuff_env_char'[0-9]+') | ||
|
||
for v in $scmpuff_env_vars | ||
set -e $v | ||
end | ||
end |
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,27 @@ | ||
package inits | ||
|
||
import "testing" | ||
|
||
func Test_defaultShellType(t *testing.T) { | ||
tests := []struct { | ||
shellenv string | ||
want string | ||
}{ | ||
// supported shells at a bunch of different locations | ||
{"/bin/zsh", "zsh"}, | ||
{"/usr/bin/zsh", "zsh"}, | ||
{"/usr/local/bin/zsh", "zsh"}, | ||
{"/bin/bash", "bash"}, | ||
{"/usr/local/bin/fish", "fish"}, | ||
|
||
// edge cases | ||
{"", "sh"}, | ||
{"/bin/unsupported", "sh"}, | ||
} | ||
for _, tt := range tests { | ||
t.Setenv("SHELL", tt.shellenv) | ||
if got := defaultShellType(); got != tt.want { | ||
t.Errorf("defaultShellType(%v) = %v, want %v", tt.shellenv, got, tt.want) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.