GitLab system status is available here and here

Commit 7814d42d authored by Anthony Umemoto's avatar Anthony Umemoto
Browse files

v1.2.1 runtime options

parent 6d5f17a4
......@@ -76,6 +76,8 @@ If the correct URL is returned, then the repair should work.
`c` Immediately perform a commit.
`t` Display the time remaining until the next commit.
`v` Toggle verbose program output.
`s` Toggle commit and push summaries.
......@@ -84,13 +86,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` Add a file name to 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.
......
......@@ -6,8 +6,11 @@ Most recent version is listed first.
+ Commit count is now correct in program output.
+ *.[file] now behaves properly in the [r file] runtime option.
+ Using a runtime command no longer causes another commit cycle to run.
+ Added the [c] runtime command to immediately perform a commit.
+ 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
......
......@@ -6,6 +6,7 @@ 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."
......@@ -13,9 +14,10 @@ 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 " 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 Displays the commit list."
echo " l Display the commit list."
echo " h Display program runtime options."
}
......@@ -41,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 ""
......@@ -105,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
......@@ -236,7 +239,7 @@ while (( $gm_reps > 0 )); do
if (( $gm_reps > 0 )); then
# nice formatting
echo "--------------------------------------------------"
echo "------------------------------------------------------------"
# verbose output
if (( $gm_verb == 1 )); then
......@@ -245,140 +248,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 # iterator for commit list
echo $gm_arg | grep -o "\*\.[a-z]*"
# test for *.file
if [[ $(echo $gm_arg | grep -o "\*\.[a-z]*") != "" ]]; then
gm_arg=$(echo $gm_arg | grep -o "\.[a-z]*")
echo $gm_arg
# 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."
else
((gm_i+=1))
fi
done
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 == "" ]]; then
echo "Interval between commits is currently $gm_freq mins."
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_arg from the commit list."
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
done
fi
fi
fi;;
l) # print commit list
echo "Current file names in the commit list:"
echo "${gm_files[*]}";;
if (( $gm_i > ${#gm_files[@]} )); then
echo "$gm_arg was not found in the commit list."
fi
fi;;
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