diff options
author | Kane York <kanepyork@gmail.com> | 2020-09-03T21·20-0700 |
---|---|---|
committer | kanepyork <rikingcoding@gmail.com> | 2020-09-03T22·03+0000 |
commit | dd94d3036a4d176efcd4c00bbd767d679e8bcebb (patch) | |
tree | aa2ee661bfd201cba92bf31d51435392a37da55b /users/riking/dotfiles/fish/functions/gh-clone.fish | |
parent | 2f7b688389058b454ee12adc4b6b47740298f53b (diff) |
feat(u/riking/dotfiles): convert bashrc functions to fish r/1760
Change-Id: I8a7d1806a8920d31c0b572a4259eef908339e449 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1927 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'users/riking/dotfiles/fish/functions/gh-clone.fish')
-rw-r--r-- | users/riking/dotfiles/fish/functions/gh-clone.fish | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/users/riking/dotfiles/fish/functions/gh-clone.fish b/users/riking/dotfiles/fish/functions/gh-clone.fish new file mode 100644 index 000000000000..109ec353f6db --- /dev/null +++ b/users/riking/dotfiles/fish/functions/gh-clone.fish @@ -0,0 +1,18 @@ +function gh-clone --description 'Clone and CD to a github repository' + if test (count $argv) -eq 1 + set user (string split "/" -- $argv[1])[1] + set repo (string split "/" -- $argv[1])[2] + else + set user $argv[1] + set repo $argv[2] + end + + if test -d "$HOME/go/src/github.com/$user/$repo" + cd "$HOME/go/src/github.com/$user/$repo" + return 0 + end + mkdir -p "$HOME/go/src/github.com/$user" + cd "$HOME/go/src/github.com/$user" + git clone "git@github.com:$user/$repo.git" + cd "$HOME/go/src/github.com/$user/$repo" +end |