From 8881b414cd4efb6c92126e186e61d39a867c1714 Mon Sep 17 00:00:00 2001 From: Adam Abrams Date: Fri, 12 Jun 2020 19:46:32 -0500 Subject: [PATCH] fix: quiet and background git --- CHANGELOG.md | 8 +++++++- README.md | 2 +- ideas | 19 ++++++++++--------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0624a19..96badde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.1] - 2020-06-12 +### Fixed +- Make git commands quiet. +- Make git commands run asynchronously when possible. + ## [0.3.0] - 2020-06-11 ### Added - Add rm command for easily removing old ideas. @@ -19,7 +24,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Created a script with the basic functionality. -[Unreleased]: https://github.com/adamtabrams/ideas/compare/0.3.0...HEAD +[Unreleased]: https://github.com/adamtabrams/ideas/compare/0.3.1...HEAD +[0.3.1]: https://github.com/adamtabrams/ideas/compare/0.3.0...0.3.1 [0.3.0]: https://github.com/adamtabrams/ideas/compare/0.2.0...0.3.0 [0.2.0]: https://github.com/adamtabrams/ideas/compare/0.1.0...0.2.0 [0.1.0]: https://github.com/adamtabrams/ideas/releases/tag/0.1.0 diff --git a/README.md b/README.md index f69fbdd..d8c21f4 100644 --- a/README.md +++ b/README.md @@ -32,4 +32,4 @@ View or edit existing ideas with `ideas` or `ideas NAME` Remove unneeded ideas with `ideas rm` -Ideas automatically handles keeping your private repo synced. +Ideas automatically handles keeping your private repo synced diff --git a/ideas b/ideas index 3b90157..821fb54 100755 --- a/ideas +++ b/ideas @@ -37,7 +37,7 @@ rm_idea() { prev_dir=$(pwd) cd "$repo" || return 2 - git pull + git pull -q idea=$(select_idea "$repo") [ ! "$idea" ] && return @@ -46,12 +46,13 @@ rm_idea() { printf "delete %s? (y/n): " "$idea" read -r confirm [ "$confirm" = y ] && + echo "deleting $idea" >&2 && rm "$idea_file" && sed -n -i "" -e "/^- \[$idea\]($idea.md)$/!p" README.md && - echo "deleted" >&2 && git add README.md "$idea_file" && - git commit -m "removed $idea" && - git push + git commit -q -m "removed $idea" && + git push -q && + echo "done" >&2 cd "$prev_dir" || return 2 } @@ -63,7 +64,7 @@ add_idea() { prev_dir=$(pwd) cd "$repo" || return 2 - git pull + git pull -q idea_file="$repo/$idea.md" [ -e "$idea_file" ] && echo "$idea_file already exists" >&2 && return 1 @@ -71,7 +72,7 @@ add_idea() { echo "- [$idea]($idea.md)" >> "$repo/README.md" printf "## %s\n\n" "$idea" > "$idea_file" ${EDITOR:-vi} "$idea_file" - git add README.md "$idea_file" && git commit -m "added $idea" && git push + git add README.md "$idea_file" && git commit -q -m "added $idea" && git push -q & cd "$prev_dir" || return 2 } @@ -106,10 +107,10 @@ repo=$(get_repo) || exit 1 prev_dir=$(pwd) cd "$repo" || exit 2 -git pull idea=$1 -[ ! "$idea" ] && idea=$(select_idea "$repo") +[ "$idea" ] && git pull -q +[ ! "$idea" ] && { git pull -q & } && idea=$(select_idea "$repo") [ ! "$idea" ] && exit idea_file="$repo/$idea.md" @@ -119,6 +120,6 @@ prev_mod=$(stat -qf "%Sc" "$idea_file") ${EDITOR:-vi} "$idea_file" [ "$prev_mod" != "$(stat -qf "%Sc" "$idea_file")" ] && - git add README.md "$idea_file" && git commit -m "modified $idea" && git push + git add "$idea_file" && git commit -q -m "modified $idea" && git push -q & cd "$prev_dir" || exit 2