GitLab system status is available here and here

Commit 1febae34 authored by Anthony Umemoto's avatar Anthony Umemoto
Browse files

v1.2.0 branch switching

parent cf4cc2cc
......@@ -26,7 +26,7 @@ gitmang requires that a terminal window is dedicated to running it. Open a new t
Or open a new git bash window in your gitmang local repository.
When quitting the program, use the 'q' input option to quit properly. Always remember to quit properly before turning off your machine. If gitmang is unexpectedly ended while it is performing a commit, the local repository may become corrupt. If this happens, delete the repository directory with:
When quitting the program, use the 'q' runtime option to quit properly. Always remember to quit properly before turning off your machine. If gitmang is unexpectedly ended while it is performing a commit, the local repository may become corrupt. If this happens, delete the repository directory with:
`$ rm -rf <dir>`
......@@ -58,13 +58,13 @@ If the correct URL is returned, then the repair should work.
`-R dir` Repairs the corrupted repository dir (path from working directory), saving un-committed files.
`-B` Keeps gm_repair_backup directory after repository repair. This can be used as a backup in case [-R dir] fails. gm_repair_backup is placed in the same directory the local repository is a child of.
`-B` Keeps gm_repair_backup directory after repository repair. This can be used as a backup in case [-R dir] fails. gm_repair_backup is placed in the same directory the repaired repository is a child of.
`file1 file2 ...` File names that will be added to the commit list.
`-h` Display program usage and synopsis.
## PROGRAM INPUT
## RUNTIME OPTIONS
`q` Quits the program.
......@@ -74,6 +74,8 @@ If the correct URL is returned, then the repair should work.
`d dir` Changes the git repo being managed. The file path should be from the current working directory.
`b branch` Moves to branch. Creates branch if it does not exist.
`f freq` Changes the interval between each commit.
`a file` Adds a single file to the commit list. To add another file, [a file] will need to be used again.
......@@ -82,9 +84,7 @@ If the correct URL is returned, then the repair should work.
`l` Displays the commit list.
`b branch` Moves to branch. Creates branch if it does not exist.
`h` Display program input options.
`h` Display program runtime options.
## OUTPUT
......@@ -98,7 +98,7 @@ If you encounter a bug, please report it using this form: https://docs.google.co
### ERRORS
### UNEXPECTED BEHAVIORS
### UNEXPECTED/UNWANTED BEHAVIORS
+ A commit is counted even if nothing is pushed. This is seen in the verbose output, and the program output.
......
......@@ -4,11 +4,12 @@ Most recent version is listed first.
### v1.2.0 March 23, 2022 7:30PM PDT
+ Added branch switching with the [-b branch] option. The same can be done with the [b brach] input option to switch branches during runtime.
+ Verbose output can now be enabled with the [-v] option. Using the [v] input option toggles verbose output during runtime.
+ Commit and push summaries can now be silenced with [-s] option. Using the [s] input option toggles the summaries during runtime.
+ Added the [l] input option, which displays what files are currently in the commit list.
+ Added the [r file] input option, which removes the file name from the commit list.
+ "Input options" are now referred to as "Runtime Options" to prevent confusion with "Command Line Options".
+ Added branch switching with the [-b branch] option. The same can be done with the [b brach] runtime option to switch branches during runtime.
+ Verbose output can now be enabled with the [-v] option. Using the [v] runtime option toggles verbose output during runtime.
+ Commit and push summaries can now be silenced with [-s] option. Using the [s] runtime option toggles the summaries during runtime.
+ Added the [l] runtime option, which displays what files are currently in the commit list.
+ Added the [r file] runtime option, which removes the file name from the commit list.
+ Small documentation revisions.
### v1.0.2 March 18, 2022 7:30PM PDT
......
#!/bin/bash
function gm_options {
echo "INPUT OPTIONS"
echo "RUNTIME OPTIONS"
echo " q Quits the program."
echo " v Toggle verbose program output."
echo " s Toggle commit and push summaries."
......@@ -12,7 +12,7 @@ function gm_options {
echo " r file Removes a single file from the commit list."
echo " l Displays the commit list."
echo " b branch Moves to branch. Creates branch if it does not exist."
echo " h Display program input options."
echo " h Display program runtime options."
}
function gm_usage {
......@@ -39,7 +39,7 @@ function gm_usage {
echo " file1 ... File names that will be added to the commit list."
echo " -h Display program synopsis and usage."
echo ""
gm_options # input options
gm_options # runtime options
echo ""
echo "OUTPUT"
echo " Prints to stdout: <reps> commit(s) completed over <total time> minute(s)"
......@@ -63,7 +63,7 @@ gm_backup=0
gm_files=()
# process command line arguments
while getopts vsd:D:bf:r:R:Bh opt; do
while getopts vsd:D:b:f:r:R:Bh opt; do
case "${opt}" in
v) gm_verb=1;; # verbose output
......@@ -75,6 +75,9 @@ while getopts vsd:D:bf:r:R:Bh opt; do
gm_dir=${OPTARG}
gm_main=1;;
b) # branch name
gm_branch=${OPTARG};;
f) # frequency
if (( ${OPTARG} > 0 )); then
gm_freq=${OPTARG}
......@@ -182,6 +185,25 @@ if [[ $(git config --get remote.origin.url) == "" ]]; then
exit
fi
# move into branch
if [[ $gm_branch == "" ]]; then
echo "A branch name must be specified, remaining in master branch."
gm_branch="master"
fi
# create branch if it does not exist
if [[ $(git rev-parse --quiet --verify $gm_branch) == "" ]]; then
git branch $gm_branch
git checkout $gm_branch
git push $gm_sil --set-upstream origin $gm_branch
echo "Created new branch $gm_branch."
else
git checkout $gm_branch
fi
echo "Moved to $gm_branch branch."
git branch
gm_sreps=0 # counts how many reps were completed while program was running
gm_cmd="" # stores command if one is used during program runtime
gm_arg="" # stores argument if command requires one
......@@ -217,8 +239,8 @@ while (( $gm_reps > 0 )); do
echo ""
fi
# program input
read -t $((gm_freq*60)) -p "Input command, use h for options: " gm_cmd gm_arg
# program runtime options
read -t $((gm_freq*60)) -p "Input runtime command, use h for options: " gm_cmd gm_arg
case "$gm_cmd" in
q) gm_reps=1;; # quit
......@@ -264,6 +286,26 @@ while (( $gm_reps > 0 )); do
fi
fi
fi;;
b) # change branch
if [[ $gm_arg == "" ]]; then
echo "Branch name must be specified, remaining in $gm_branch branch."
else
gm_branch=$gm_arg
# create branch if ti does not exist
if [[ $(git rev-parse --quiet --verify $gm_branch) == "" ]]; then
git branch $gm_branch
git checkout $gm_branch
git push $gm_sil --set-upstream origin $gm_branch
echo "Created new branch $gm_branch."
else
git checkout $gm_branch
fi
echo "Moved to $gm_branch branch."
git branch
fi;;
f) # change interval
if (( $gm_arg > 0 )); then
......@@ -304,7 +346,7 @@ while (( $gm_reps > 0 )); do
echo "Current file names in the commit list:"
echo "${gm_files[*]}";;
h) gm_options;; # input options
h) gm_options;; # runtime options
esac
fi
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment