Adds help for update

This commit is contained in:
Thomas Forgione 2019-06-03 17:25:28 +02:00
parent 08c918b3c0
commit cc029484d6
No known key found for this signature in database
GPG Key ID: 203DAEA747F48F41
1 changed files with 28 additions and 0 deletions

View File

@ -309,7 +309,27 @@ update-postpone() {
}
_print_help() {
echo -e "\033[32mupdate\033[0m"
echo -e "Thomas Forgione <thomas@forgione.fr>"
echo -e "A script that automatically updates your system"
echo
_print_usage
}
_print_usage() {
echo -e "\033[33mUSAGE:\033[0m"
echo -e " update <subcommand>"
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