From 454bbd8d7487855bcfbffc4d7152e8edfe89bb24 Mon Sep 17 00:00:00 2001 From: Matt Broyles Date: Wed, 15 Jun 2016 20:38:55 -0500 Subject: [PATCH 1/3] Added gittowork plugin --- plugins/available/gittowork.plugin.bash | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins/available/gittowork.plugin.bash diff --git a/plugins/available/gittowork.plugin.bash b/plugins/available/gittowork.plugin.bash new file mode 100644 index 00000000..9b68d27c --- /dev/null +++ b/plugins/available/gittowork.plugin.bash @@ -0,0 +1,23 @@ +cite about-plugin +about-plugin 'Downloads the latest .gitignore file by project type' + +function gittowork() { + about 'Places the latest .gitignore file for a given project type in the current directory, or concatenates onto an existing .gitignore' + group 'git' + + result=$(curl -L "Https://www.gitignore.io/api/$1" 2>/dev/null) + + if [[ $result =~ ERROR ]]; then + echo "Query '$1' has no match. See a list of possible queries with 'GitToWork List'" + elif [[ $1 = list ]]; then + echo "$result" + else + if [[ -f .gitignore ]]; then + result=`echo "$result" | grep -v "# Created by http://www.gitignore.io"` + echo ".gitignore already exists, appending..." + echo "$result" >> .gitignore + else + echo "$result" > .gitignore + fi + fi +} \ No newline at end of file From 478e8ddb1bba6b61be4ad7c297aa563e9b7ee34f Mon Sep 17 00:00:00 2001 From: Matt Broyles Date: Wed, 15 Jun 2016 20:40:19 -0500 Subject: [PATCH 2/3] Inserted newline after gittowork --- plugins/available/gittowork.plugin.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/available/gittowork.plugin.bash b/plugins/available/gittowork.plugin.bash index 9b68d27c..bcad46dd 100644 --- a/plugins/available/gittowork.plugin.bash +++ b/plugins/available/gittowork.plugin.bash @@ -4,7 +4,7 @@ about-plugin 'Downloads the latest .gitignore file by project type' function gittowork() { about 'Places the latest .gitignore file for a given project type in the current directory, or concatenates onto an existing .gitignore' group 'git' - + result=$(curl -L "Https://www.gitignore.io/api/$1" 2>/dev/null) if [[ $result =~ ERROR ]]; then @@ -20,4 +20,4 @@ function gittowork() { echo "$result" > .gitignore fi fi -} \ No newline at end of file +} From fe8254b574f522a5aa96cbdc451ff9382bc6d630 Mon Sep 17 00:00:00 2001 From: Matt Broyles Date: Mon, 20 Jun 2016 10:32:01 -0500 Subject: [PATCH 3/3] Moved gittowork to git.plugin.bash, removed gittowork.plugin.bash --- plugins/available/git.plugin.bash | 22 ++++++++++++++++++++++ plugins/available/gittowork.plugin.bash | 23 ----------------------- 2 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 plugins/available/gittowork.plugin.bash diff --git a/plugins/available/git.plugin.bash b/plugins/available/git.plugin.bash index 6506ca45..27de163f 100644 --- a/plugins/available/git.plugin.bash +++ b/plugins/available/git.plugin.bash @@ -198,3 +198,25 @@ else fi } +function gittowork() { + about 'Places the latest .gitignore file for a given project type in the current directory, or concatenates onto an existing .gitignore' + group 'git' + + result=$(curl -L "Https://www.gitignore.io/api/$1" 2>/dev/null) + + if [[ $result =~ ERROR ]]; then + echo "Query '$1' has no match. See a list of possible queries with 'gittowork List'" + elif [[ $1 = list ]]; then + echo "$result" + else + if [[ -f .gitignore ]]; then + result=`echo "$result" | grep -v "# Created by http://www.gitignore.io"` + echo ".gitignore already exists, appending..." + echo "$result" >> .gitignore + else + echo "$result" > .gitignore + fi + fi +} + + diff --git a/plugins/available/gittowork.plugin.bash b/plugins/available/gittowork.plugin.bash deleted file mode 100644 index bcad46dd..00000000 --- a/plugins/available/gittowork.plugin.bash +++ /dev/null @@ -1,23 +0,0 @@ -cite about-plugin -about-plugin 'Downloads the latest .gitignore file by project type' - -function gittowork() { - about 'Places the latest .gitignore file for a given project type in the current directory, or concatenates onto an existing .gitignore' - group 'git' - - result=$(curl -L "Https://www.gitignore.io/api/$1" 2>/dev/null) - - if [[ $result =~ ERROR ]]; then - echo "Query '$1' has no match. See a list of possible queries with 'GitToWork List'" - elif [[ $1 = list ]]; then - echo "$result" - else - if [[ -f .gitignore ]]; then - result=`echo "$result" | grep -v "# Created by http://www.gitignore.io"` - echo ".gitignore already exists, appending..." - echo "$result" >> .gitignore - else - echo "$result" > .gitignore - fi - fi -}