From 8a20399ac698585619cdcbed869bd80472445c2c Mon Sep 17 00:00:00 2001 From: Matthew Fallshaw Date: Thu, 4 Jul 2019 12:13:17 -0700 Subject: [PATCH] git-pull-subdirectories, minor fish cleanup --- config/fish/functions/cdd.fish | 3 +-- config/fish/functions/cde.fish | 3 +-- config/fish/functions/cds.fish | 3 +-- config/fish/functions/cdup.fish | 3 +-- config/fish/functions/gco.fish | 2 +- .../functions/git-pull-subdirectories.fish | 18 ++++++++++++++++++ config/fish/functions/mcd.fish | 3 +-- config/fish/functions/mtd.fish | 3 +-- 8 files changed, 25 insertions(+), 13 deletions(-) create mode 100644 config/fish/functions/git-pull-subdirectories.fish diff --git a/config/fish/functions/cdd.fish b/config/fish/functions/cdd.fish index 2ef1b00..6821730 100644 --- a/config/fish/functions/cdd.fish +++ b/config/fish/functions/cdd.fish @@ -1,5 +1,4 @@ -# cd into ~/code -function cdd +function cdd -d "cd into ~/code" set -l cdpath "$HOME/code" if [ -z "$argv[1]" ] cd $cdpath diff --git a/config/fish/functions/cde.fish b/config/fish/functions/cde.fish index 969c8cf..aa2a5f1 100644 --- a/config/fish/functions/cde.fish +++ b/config/fish/functions/cde.fish @@ -1,5 +1,4 @@ -# cd into ~/eclipse-workspace -function cde +function cde -d "cd into ~/eclipse-workspace" set -l cdpath "$HOME/eclipse-workspace" if [ -z "$argv[1]" ] cd $cdpath diff --git a/config/fish/functions/cds.fish b/config/fish/functions/cds.fish index d1ce6c6..6b054aa 100644 --- a/config/fish/functions/cds.fish +++ b/config/fish/functions/cds.fish @@ -1,5 +1,4 @@ -# cd into ~/source -function cds +function cds -d "cd into ~/source" set -l cdpath "$HOME/source" if [ -z "$argv[1]" ] cd $cdpath diff --git a/config/fish/functions/cdup.fish b/config/fish/functions/cdup.fish index 38d9bd5..9d36546 100644 --- a/config/fish/functions/cdup.fish +++ b/config/fish/functions/cdup.fish @@ -1,5 +1,4 @@ -# cd up n directories -function cdup +function cdup -d "cd up n directories" set -l ups "" for i in (seq 1 $argv[1]) set ups $ups"../" diff --git a/config/fish/functions/gco.fish b/config/fish/functions/gco.fish index 082643c..24ee73d 100644 --- a/config/fish/functions/gco.fish +++ b/config/fish/functions/gco.fish @@ -1,4 +1,4 @@ -function gco +function gco -d "`git checkout [master | arg`" if [ -z "$argv[1]" ]; then git checkout master else diff --git a/config/fish/functions/git-pull-subdirectories.fish b/config/fish/functions/git-pull-subdirectories.fish new file mode 100644 index 0000000..bc0a179 --- /dev/null +++ b/config/fish/functions/git-pull-subdirectories.fish @@ -0,0 +1,18 @@ +function git-pull-subdirectories -d "`git pull` all subdirectories of pwd" + echo 'Pulling subdirectories...' + set -l start_dir (pwd) + for d in (ls -d */) + echo $d + cd $d + if test -d .git + git pull + else + echo "Not a git repo" + end + cd $start_dir + echo + echo + echo + end + and echo 'Finished.' +end diff --git a/config/fish/functions/mcd.fish b/config/fish/functions/mcd.fish index b21fbff..a634e25 100644 --- a/config/fish/functions/mcd.fish +++ b/config/fish/functions/mcd.fish @@ -1,4 +1,3 @@ -# Make a directory and cd into it -function mcd +function mcd -d "Make a directory and cd into it" mkdir -p "$argv[1]"; and cd "$argv[1]" end diff --git a/config/fish/functions/mtd.fish b/config/fish/functions/mtd.fish index 2b033df..06addce 100644 --- a/config/fish/functions/mtd.fish +++ b/config/fish/functions/mtd.fish @@ -1,5 +1,4 @@ -# Make a temp directory and cd into it -function mtd +function mtd -d "Make a temp directory and cd into it" set -l dir (mktemp -d) if test -n "$dir" if test -d "$dir"