From cc029484d6d88842e01fea87a7ae014cf215e99c Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 3 Jun 2019 17:25:28 +0200 Subject: [PATCH] Adds help for update --- bin/update | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/bin/update b/bin/update index b2ac714..f5d63f7 100755 --- a/bin/update +++ b/bin/update @@ -309,7 +309,27 @@ update-postpone() { } _print_help() { + echo -e "\033[32mupdate\033[0m" + echo -e "Thomas Forgione " + echo -e "A script that automatically updates your system" echo + _print_usage +} + +_print_usage() { + echo -e "\033[33mUSAGE:\033[0m" + echo -e " update " + echo + echo -e "\033[33mSUBCOMMANDS:\033[0m" + echo -e " \033[32msystem\033[0m Updates the system (Debian, Archlinux, Fedora)" + echo -e " \033[32mrust\033[0m Updates rust and rust packages (requires rustup)" + echo -e " \033[32mnpm\033[0m Updates npm packages (in ~/.config/npmbin)" + echo -e " \033[32mdotfiles\033[0m Updates the dotfiles" + echo -e " \033[32mneovim\033[0m Updates the neovim packages" + echo -e " \033[32mcheck\033[0m Checks whether the system has been recently updated" + echo -e " \033[32mstartup\033[0m Same as \`update check\` but is silent in case of success" + echo -e " \033[32mpostpone\033[0m Skip the current update (disable check warnings)" + echo -e " \033[32mforce-unlock\033[0m Deletes the lock file" } partial-test() { @@ -407,11 +427,19 @@ main() { local lock_required=1 for part in $@; do + + if [ $part == "-h" ] || [ $part == "--help" ]; then + _print_help + exit 0 + fi + partial-test $part if [ $? -ne 0 ]; then echo -e "\033[1;31merror:\033[0m unrocognized update command \"$part\"" + _print_usage return 1 fi + partial-requires-lock $part lock_required=$(($lock_required * $?)) done