Skip to content

Commit

Permalink
add option to force install
Browse files Browse the repository at this point in the history
Signed-off-by: Tin Lai <oscar@tinyiu.com>
  • Loading branch information
soraxas committed Jul 7, 2020
1 parent b707def commit 87cecc6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
14 changes: 4 additions & 10 deletions libexec/shsh-install
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# Usage: shsh install [site]/<package>[@ref] [<folder>/<folder>]
# [-h|--hook <hook>] [-v|--variable <VAR>=<VAL>] [--ssh]
# [--nocleanup] [--force]
# [--nocleanup] [-f|--force]
#
# Options:
# -h, --hook <HOOK_TYPE>[=<CONTENT>]
Expand All @@ -15,7 +15,7 @@
# useful for setting up files for linking
# --nocleanup do not perform cleanup (shsh uninstall <package>)
# even if something failed in the installination process
# --force force the installation even if the package exists
# -f, --force force the installation even if the package exists
# --ssh use ssh protocal instead of https
#
# --verbose display more info for some commands
Expand Down Expand Up @@ -74,7 +74,7 @@ if [ "$#" != 0 ]; then
--nocleanup)
no_cleanup="true"
;;
--force)
-f|--force)
force_install="true"
;;
-h|--hook)
Expand Down Expand Up @@ -130,13 +130,6 @@ if [ "$#" != 0 ]; then
shift # remove the EOL token
fi

# echo "\$hook_pre=$hook_pre"
# echo "\$hook_post=$hook_post"
# echo "\$hook_uninstall=$hook_uninstall"
# echo "\$hook_plus_x=$hook_plus_x"
# echo "\$hook_all_plus_x=$hook_all_plus_x"
# echo "\$@=$@"


if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
shsh-help install
Expand Down Expand Up @@ -222,6 +215,7 @@ trap on_exit EXIT


## INSTALLING
[ -n "$force_install" ] && shsh uninstall "$folder" >/dev/null 2>&1 || true
# only perform link if clone is successful (and package not exists before)
if ! shsh-_clone "$use_ssh" "$site" "$package" "$ref" "$folder"; then
exit
Expand Down
5 changes: 4 additions & 1 deletion man/man1/shsh-install.1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ shsh \- manual page for shsh v2.2.1
Installs a package from github (or a custom site)
.TP
[\-h|\-\-hook <hook>] [\-v|\-\-variable <VAR>=<VAL>] [\-\-ssh]
[\-\-nocleanup]
[\-\-nocleanup] [\-f|\-\-force]
.SH OPTIONS
.HP
\fB\-h\fR, \fB\-\-hook\fR <HOOK_TYPE>[=<CONTENT>]
Expand All @@ -26,6 +26,9 @@ useful for setting up files for linking
do not perform cleanup (shsh uninstall <package>)
even if something failed in the installination process
.TP
\fB\-f\fR, \fB\-\-force\fR
force the installation even if the package exists
.TP
\fB\-\-ssh\fR
use ssh protocal instead of https
.TP
Expand Down
5 changes: 4 additions & 1 deletion man/man1/shsh.1
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ SHELL: sh, bash, zsh, fish, etc.
Installs a package from github (or a custom site)
.TP
[\-h|\-\-hook <hook>] [\-v|\-\-variable <VAR>=<VAL>] [\-\-ssh]
.SH "\-\-NOCLEANUP"
[\-\-nocleanup] [\-f|\-\-force]
.SS OPTIONS
.HP
\fB\-h\fR, \fB\-\-hook\fR <HOOK_TYPE>[=<CONTENT>]
Expand All @@ -136,6 +136,9 @@ useful for setting up files for linking
do not perform cleanup (shsh uninstall <package>)
even if something failed in the installination process
.TP
\fB\-f\fR, \fB\-\-force\fR
force the installation even if the package exists
.TP
\fB\-\-ssh\fR
use ssh protocal instead of https
.TP
Expand Down

0 comments on commit 87cecc6

Please sign in to comment.