code style fixes

This commit is contained in:
James Tomasino 2018-01-20 21:26:33 -05:00
parent 955fd09e81
commit c75383377d
2 changed files with 37 additions and 37 deletions

60
burrow
View File

@ -1,13 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
version="v1.0.0rc" version="v1.0.0rc"
shopt -s extglob shopt -s extglob
configfiles="$HOME/.config/burrow/config $HOME/.config/burrow $HOME/.burrow" configfiles="$HOME/.config/burrow/config $HOME/.config/burrow $HOME/.burrow"
editor=${EDITOR:-vi} editor=${EDITOR:-vi}
arg_options=hvd
arg_longoptions=help,version,debug
# vars from config # vars from config
config_location_gopher="$HOME/gopher" config_location_gopher="$HOME/gopher"
config_location_recipebox="${config_location_gopher}/recipebox" config_location_recipebox="${config_location_gopher}/recipebox"
@ -22,29 +20,14 @@ config_git_push=false
flag_debug=0 flag_debug=0
# vars from args # vars from args
arg_options=hvd
arg_longoptions=help,version,debug
arg_recipe=0 arg_recipe=0
arg_phlog=0 arg_phlog=0
arg_create_config=0 arg_create_config=0
arg_update_git=0 arg_update_git=0
function show_help() { # silence directory movements
cat > /dev/stdout << END
${0} [-hvd] [--help] [--version] [--debug] <arguments>
ARGUMENTS (multiple allowed):
phlog - create new phlog entry
recipe - add new recipe to box
create-config - create a default configuration file
update-git - silently pulls gopher git repo if it exists
OPTIONAL FLAGS:
--help|-h - show this help
--version|-v - show current version info
--debug|-d - debug mode
END
}
pushd () { pushd () {
command pushd "$@" 2>/dev/null 1>&2 command pushd "$@" 2>/dev/null 1>&2
} }
@ -53,6 +36,24 @@ popd () {
command popd 2>/dev/null 1>&2 command popd 2>/dev/null 1>&2
} }
function show_help() {
cat > /dev/stdout << END
burrow [options] [commands]
COMMANDS:
phlog Create new phlog entry
recipe Add new recipe to box
create-config Create a default configuration file
update-git Silently pulls gopher git repo if it exists
OPTIONAL FLAGS:
-h, --help Show this help
-v, --version Show current version info
-d, --debug Debug mode
END
}
function parse_input() { function parse_input() {
getopt --test > /dev/null getopt --test > /dev/null
if [[ $? -ne 4 ]] if [[ $? -ne 4 ]]
@ -93,25 +94,25 @@ function parse_input() {
esac esac
done done
if [[ $# -lt 1 ]]; then if [[ $# -lt 1 ]]
then
exit 0 exit 0
fi fi
for arg in "$@" for arg in "$@"
do do
argc=${arg^^} argc=${arg,,}
case $argc in case $argc in
"SHORTLIST") "shortlist")
echo "phlog recipe create-config update-git" echo "phlog recipe create-config update-git"
exit 0 exit 0
;; ;;
"PHLOG") arg_phlog=1 ;; "phlog") arg_phlog=1 ;;
"RECIPE") arg_recipe=1 ;; "recipe") arg_recipe=1 ;;
"CREATE-CONFIG") arg_create_config=1 ;; "create-config") arg_create_config=1 ;;
"UPDATE-GIT") arg_update_git=1 ;; "update-git") arg_update_git=1 ;;
esac esac
done done
} }
function day_suffix() { function day_suffix() {
@ -171,7 +172,6 @@ function recipe_new() {
echo "Updating recipebox listing" echo "Updating recipebox listing"
echo -e "0$title\t$(basename "$post_path")\n$(cat "${config_location_recipebox}/gophermap")" > "${config_location_recipebox}/gophermap" echo -e "0$title\t$(basename "$post_path")\n$(cat "${config_location_recipebox}/gophermap")" > "${config_location_recipebox}/gophermap"
sort -fo "${config_location_recipebox}/gophermap" "${config_location_recipebox}/gophermap" sort -fo "${config_location_recipebox}/gophermap" "${config_location_recipebox}/gophermap"
update_gopher_date update_gopher_date
if [[ $config_post_recipebox_command != "" ]] if [[ $config_post_recipebox_command != "" ]]

View File

@ -2,12 +2,11 @@
.SH NAME .SH NAME
burrow \- a helper for building and managing a gopher hole burrow \- a helper for building and managing a gopher hole
.SH SYNOPSIS .SH SYNOPSIS
burrow [-vf] [action] burrow [options] [command]
.SH DESRIPTION .SH DESRIPTION
.B burrow burrow is a collection of helper actions designed to assist in the creation,
is a collection of helper actions designed to assist in the creation,
modification, and maintenance of a gopher hole. modification, and maintenance of a gopher hole.
.SH OPTIONS .SH COMMANDS
.TP .TP
.B phlog .B phlog
Create a new phlog entry. Create a new phlog entry.
@ -26,14 +25,15 @@ If the gopher directory resides within a git repository, this action will do a
silent silent
.B git-pull .B git-pull
which is useful for crons. which is useful for crons.
.SH OPTIONS
.TP .TP
.B -v|--version .B -v, --version
Display current version information. Display current version information.
.TP .TP
.B -d|--debug .B -d, --debug
Debug mode. Debug mode.
.TP .TP
.B -h|--help .B -h, --help
Show the help. Show the help.
.SH FILES .SH FILES
.I ~/.config/burrow/config .I ~/.config/burrow/config