GitLab system status is available here and here

Commit 0ae03f6d authored by Anthony Umemoto's avatar Anthony Umemoto
Browse files

v1.2.1

parents dd782385 523df3ad
<<<<<<< HEAD
# GITMANG v1.2.0
=======
# GITMANG v1.2.1
>>>>>>> beta
gitmang can be downloaded off the gitLab web interface, or the gitmang master branch can be pulled using:
......@@ -74,6 +78,13 @@ If the correct URL is returned, then the repair should work.
`q` Quits the program.
<<<<<<< HEAD
=======
`c` Immediately perform a commit.
`t` Display the time remaining until the next commit.
>>>>>>> beta
`v` Toggle verbose program output.
`s` Toggle commit and push summaries.
......@@ -82,13 +93,13 @@ If the correct URL is returned, then the repair should work.
`b branch` Moves to branch. Creates branch if it does not exist. If no branch is specified, then the branch list will be printed.
`f freq` Changes the interval between each commit.
`f freq` Changes the interval between each commit. If no freq is specified, then the current interval will be displayed.
`a file` Adds a single file to the commit list. To add another file, [a file] will need to be used again.
`a file` Add a file name to the commit list.
`r file` Removes a single file from the commit list.
`r file` Remove a file name from the commit list.
`l` Displays the commit list.
`l` Display the commit list.
`h` Display program runtime options.
......@@ -107,7 +118,6 @@ If you encounter a bug, please report it using this form: https://docs.google.co
### UNEXPECTED/UNWANTED BEHAVIORS
+ A commit is counted even if nothing is pushed. This is seen in the verbose output, and the program output.
+ Usage and synopsis may not fit in terminal windows completely. This is particularly a problem for terminals that cannot scroll up.
### ARCHITECTURE
......
......@@ -2,11 +2,22 @@
Most recent version is listed first.
### v1.2.1 March 24, 2022, 6:50 PDT
+ Commit count is now correct in program output.
+ *.[file] now behaves properly in the [r file] runtime option.
+ Using a runtime option no longer causes another commit cycle to run.
+ Added the [c] runtime option to immediately perform a commit.
+ Added the [t] runtime option to display the time remaining until the next commit.
+ Removed runtime options from the usage and synopsis displayed with [-h]. They can still be viewed using the [h] runtime option.
+ The [f freq] runtime option now displays the current interval if no freq is specified.
+ Minor documentation revisions.
### v1.2.0 March 22, 2022 3:30PM PDT
+ "Input Options" are now referred to as "Runtime Options" to prevent confusion with "Command Line Options".
+ Other small documentation revisions.
+ Added branch switching with the [-b branch] option. The same can be done with the [b brach] runtime option to switch branches during runtime.
+ Added branch switching with the [-b branch] option. The same can be done with the [b branch] 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.
......
......@@ -5,6 +5,8 @@
function gm_options {
echo "RUNTIME OPTIONS"
echo " q Quits the program."
echo " c Immediately perform a commit."
echo " t Display the time remaining until the next commit."
echo " v Toggle verbose program output."
echo " s Toggle commit and push summaries."
echo " d dir Changes the git repository being managed."
......@@ -12,16 +14,15 @@ function gm_options {
echo " b branch Moves to branch. Creates branch if it does not exist."
echo " If no branch is specified, then the branch list will be printed."
echo " f freq Changes the interval between each commit."
echo " a file Add a single file to the commit list."
echo " r file Removes a single file from the commit list."
echo " l Displays the commit list."
echo " If no freq is specified, then the current interval will be displayed."
echo " a file Add a file name to the commit list."
echo " r file Remove a file name from the commit list."
echo " l Display the commit list."
echo " h Display program runtime options."
}
function gm_usage {
echo "GITMANG.SH HELP: For more usage information, view the README."
echo ""
echo "SYNOPSIS"
echo "GITMANG.SH SYNOPSIS: For more usage information, view the README."
echo " A shell script that commits specified files at a regular interval."
echo ""
echo "USAGE"
......@@ -42,8 +43,6 @@ 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 # runtime options
echo ""
echo "OUTPUT"
echo " Prints to stdout: <reps> commit(s) completed over <total time> minute(s)"
echo ""
......@@ -106,6 +105,9 @@ while getopts vsd:D:b:f:r:R:Bh opt; do
h) # program usage and synopsis
gm_usage
exit;;
*)
gm_usage
exit;;
esac
done
......@@ -227,17 +229,20 @@ while (( $gm_reps > 0 )); do
for gm_ft in "${gm_files[@]}"; do
git add $gm_ft
done
git commit $gm_sil -m "autosaving progress $(date)"
gm_com=$(git commit $gm_sil -m "autosaving progress $(date)")
echo "$gm_com"
git push $gm_sil
trap - SIGINT
# tracking progress
((gm_reps-=1))
((gm_sreps+=1))
if [[ $(echo "$gm_com" | grep -o "nothing to commit") != "nothing to commit" ]]; then
((gm_sreps+=1))
fi
if (( $gm_reps > 0 )); then
# nice formatting
echo "--------------------------------------------------"
echo "------------------------------------------------------------"
# verbose output
if (( $gm_verb == 1 )); then
......@@ -246,120 +251,161 @@ while (( $gm_reps > 0 )); do
echo ""
fi
gm_ctime=$(date "+%s") # used to track interval start time
gm_ftime=$(( $(( $(date "+%s") - $gm_ctime )) / 60 )) # time left in interval
gm_cont=0 # set to 1 to exit the runtime command input loop
# 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
v) # toggle verbose output
if (( $gm_verb == 0 )); then
gm_verb=1
echo "Enabling verbose program output."
else
gm_verb=0
echo "Disabling verbose program output."
fi;;
s) # toggle summary silence
if [[ $gm_sil == "-q" ]]; then
gm_sil=""
echo $gm_sil
echo "Unsilencing commit and push summaries."
else
gm_sil="-q"
echo "Silencing commit and push summaries."
fi;;
d) # changed directories
# check for invalid directory
if [[ gm_arg == "" ]]; then
echo "Repo directory must be specified."
else
gm_tmpdir=$(pwd)
cd $gm_arg
# test if gm_dir is a valid path
if [[ $gm_tmpdir == $(pwd) ]]; then
echo "Failed to move into $gm_arg, remaining in $gm_dir."
while (( $gm_ftime < $gm_freq && $gm_cont == 0 )); do
read -t $(($(($gm_freq - $gm_ftime)) * 60)) -p "Input runtime command, use h for options: " gm_cmd gm_arg
case "$gm_cmd" in
q) # quit
gm_reps=1
gm_cont=1;;
c) # immediately perform a commit
gm_cont=1;;
t) # display remaining time in interval
echo "$(($gm_freq - $gm_ftime)) mins left before next commit.";;
v) # toggle verbose output
if (( $gm_verb == 0 )); then
gm_verb=1
echo "Enabled verbose program output."
else
# test if gm_dir is a valid repo
if [[ $(git config --get remote.origin.url) == "" ]]; then
echo "$gm_arg is not a repository, remaining in $gm_dir."
cd
cd $gm_tmpdir
gm_verb=0
echo "Disabled verbose program output."
fi;;
s) # toggle summary silence
if [[ $gm_sil == "-q" ]]; then
gm_sil=""
echo $gm_sil
echo "Unsilenced commit and push summaries."
else
gm_sil="-q"
echo "Silenced commit and push summaries."
fi;;
d) # changed directories
# check for invalid directory
if [[ gm_arg == "" ]]; then
echo "Repo directory must be specified."
else
gm_tmpdir=$(pwd)
cd $gm_arg
# test if gm_dir is a valid path
if [[ $gm_tmpdir == $(pwd) ]]; then
echo "Failed to move into $gm_arg, remaining in $gm_dir."
else
gm_dir=$gm_arg
echo "Switched directory to $gm_arg."
# test if gm_dir is a valid repo
if [[ $(git config --get remote.origin.url) == "" ]]; then
echo "$gm_arg is not a repository, remaining in $gm_dir."
cd
cd $gm_tmpdir
else
gm_dir=$gm_arg
echo "Switched directory to $gm_arg."
fi
fi
fi
fi;;
fi;;
b) # change branch
if [[ $gm_arg == "" ]]; then
git 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."
b) # change branch
if [[ $gm_arg == "" ]]; then
git branch
else
git checkout $gm_branch
fi
echo "Moved to $gm_branch branch."
git branch
fi;;
f) # change interval
if (( $gm_arg > 0 )); then
gm_freq=$gm_arg
echo "Changed interval to $gm_arg minute(s)."
else
echo "Interval must be greater than 0."
fi;;
a) # add file
if [[ $gm_arg == "" ]]; then
echo "A file name must be specified."
else
gm_files+=( $gm_arg )
echo "Added $gm_arg to the commit list."
fi;;
r) # remove file
if [[ $gm_arg == "" ]]; then
echo "A file name must be specified."
else
gm_i=0
for gm_fname in "${gm_files[@]}"; do
if [[ $gm_fname == $gm_arg ]]; then
unset gm_files[$gm_i]
echo "Removed $gm_arg from the commit list."
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
((gm_i+=1))
git checkout $gm_branch
fi
done
if (( $gm_i > ${#gm_files[@]} )); then
echo "$gm_arg was not found in the commit list."
fi
fi;;
echo "Moved to $gm_branch branch."
git branch
fi;;
f) # change interval
if [[ $gm_arg == "" ]]; then
echo "Interval between commits is currently $gm_freq mins."
else
if (( $gm_arg > 0 )); then
gm_freq=$gm_arg
echo "Changed interval to $gm_arg minute(s)."
else
echo "Interval must be greater than 0, remaining at $gm_freq mins."
fi
fi;;
a) # add file
if [[ $gm_arg == "" ]]; then
echo "A file name must be specified."
else
gm_files+=( "$gm_arg" )
echo "Added $gm_arg to the commit list."
fi;;
r) # remove file
if [[ $gm_arg == "" ]]; then
echo "A file name must be specified."
else
gm_i=0 # iterator for commit list
if [[ $gm_arg == "*" ]]; then # removes all files
gm_files=()
echo "Removed all file names from the commit list."
elif [[ $(echo "$gm_arg" | grep -o "\*\.[a-z]*") != "" ]]; then # test for *.file
gm_arg=$(echo "$gm_arg" | grep -o "\.[a-z]*")
# search through commit list for file extension
for gm_fname in "${gm_files[@]}"; do
if [[ $(echo "$gm_fname" | grep "$gm_arg") != "" ]]; then
unset "gm_files[$gm_i]"
echo "Removed $gm_fname from the commit list."
fi
((gm_i+=1))
done
else
# search through commit list for exact file name
for gm_fname in "${gm_files[@]}"; do
if [[ $gm_fname == $gm_arg ]]; then
unset "gm_files[$gm_i]"
echo "Removed $gm_fname from the commit list."
else
((gm_i+=1))
fi
done
if (( $gm_i > ${#gm_files[@]} )); then
echo "$gm_arg was not found in the commit list."
fi
fi
fi;;
l) # print commit list
echo "Current file names in the commit list:"
echo "${gm_files[*]}";;
h) gm_options;; # runtime options
l) # print commit list
echo "Current file names in the commit list:"
echo "${gm_files[*]}";;
*) echo "Failed to execute runtime command.";;
esac
h) gm_options;; # runtime options
esac
gm_ftime=$(( $(( $(date "+%s") - $gm_ctime )) / 60 )) # time left in interval
done
fi
# nice formatting
echo ""
echo "--------------------------------------------------"
echo "------------------------------------------------------------"
done
......
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