Skip to content

Commit

Permalink
Move 'add' command to separate executable
Browse files Browse the repository at this point in the history
  • Loading branch information
extsoft authored and rultor committed Sep 6, 2017
1 parent 34c05b7 commit 8db08a5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/main/git-elegant
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,21 @@ push-after-rebase() {
git-elegant push
}

add() {
local FILES=$(git ls-files -m)
__gm "There are candidates to be added to commit:"
__loop "__gm -" ${FILES[@]}
__batch "Do you want to add all of them?" "Add this?" "git add" ${FILES[@]}
git status
feature() {
_validate "$1" "Feature name"
git-elegant pull $MASTER
git checkout -b "$1"
}

clear-local() {
git-elegant pull $MASTER
local cmd="git branch -lvv | grep gone | awk {'print \$1'}"
__loop "git branch -d" $(eval "$cmd") || \
(
__gm "There are unmerged branches:" && \
__loop "__gm -" $(eval "$cmd") && \
__batch "Do you want to delete all unmerged branches?" "Delete this?" "git branch -D" $(eval "$cmd")
)
}

usage() {
Expand Down
10 changes: 10 additions & 0 deletions src/main/git-elegant-add
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e

default() {
local FILES=$(git ls-files -m)
__gm "There are candidates to be added to commit:"
__loop "__gm -" ${FILES[@]}
__batch "Do you want to add all of them?" "Add this?" "git add" ${FILES[@]}
git status
}

0 comments on commit 8db08a5

Please sign in to comment.