diff options
author | Malf Furious <m@lfurio.us> | 2017-04-29 20:39:25 -0400 |
---|---|---|
committer | Malf Furious <m@lfurio.us> | 2017-04-29 20:39:25 -0400 |
commit | d919e18488c196caf7a8ea7a8db9bd7dc75995d0 (patch) | |
tree | 9938a60fd5ea9fb5fb7adae220d0df94e00d6361 | |
parent | 5de1fd7075686d8e8ba7861e789b343808383e20 (diff) | |
download | systrunk-d919e18488c196caf7a8ea7a8db9bd7dc75995d0.tar.gz systrunk-d919e18488c196caf7a8ea7a8db9bd7dc75995d0.zip |
Add status module
-rw-r--r-- | main.sh | 2 | ||||
-rw-r--r-- | status.sh | 44 |
2 files changed, 46 insertions, 0 deletions
@@ -15,6 +15,8 @@ function main if [[ "$1" == "checkout" ]]; then systr_checkout $@ + elif [[ "$1" == "status" ]]; then + systr_status $@ else echo "Error: $1 not recognized" fi diff --git a/status.sh b/status.sh new file mode 100644 index 0000000..893dde2 --- /dev/null +++ b/status.sh @@ -0,0 +1,44 @@ +## +# systrunk status +# +# View current information such as which branch your worktree is +# TRACking, which commit it is BASEd on, and how far out-of-date +# it is. Additionally, report whether a merge or update operation +# is currently in-progress. +## +function systr_status +{ + read remote <.systr/remote + read path <.systr/path + read BASE <.systr/BASE + read TRAC <.systr/TRAC + + if [ -f ".systr/MERG" ]; then + read MERG <.systr/MERG + mergcommit=$(get_commit "$MERG") + + if [[ "$MERG" == "TRAC" ]]; then + echo "Update in progress, to $mergcommit" + else + echo "Merge in progress, from $MERG ($mergcommit)" + fi + + echo "" + fi + + traccommit=$(get_commit "$TRAC") + + if [[ "$TRAC" == "$traccommit" ]]; then + echo "Not tracking any branch" + else + echo "Tracking $TRAC ($traccommit)" + fi + + if [[ "$BASE" == "NULL" ]]; then + echo "BASE unset" + else + echo "BASE at $BASE" + fi + + echo "# TODO # Possibly, Up-to-date" +} |