From c2fe4ca3bfe96497903dbf9472857613a360395b Mon Sep 17 00:00:00 2001 From: Riyyi Date: Wed, 18 Aug 2021 02:13:47 +0200 Subject: [PATCH] Manager: Improve help output formatting, display help without options --- dotfiles.sh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/dotfiles.sh b/dotfiles.sh index 5e37fe0..5d17361 100755 --- a/dotfiles.sh +++ b/dotfiles.sh @@ -46,18 +46,18 @@ ${B}OPTIONS${N} ${B}-h, --help${N} Display usage message and exit. - ${B}-p${N} [${U}ARG${N}], ${B}--packages${N} [${U}ARG${N}] - ${B}install${N} - Install all core packages of the stored list. + ${B}-p${N} [${U}FUNCTION${N}], ${B}--packages${N} [${U}FUNCTION${N}] + Apply ${U}FUNCTION${N} to the package manager packages. - ${B}install-aur${N} - Install all AUR packages of the stored list. + ${U}install${N} Install all core packages of the stored list. - ${B}list${N} (default) - Display all packages installed on the system. + ${U}install-aur${N} Install all AUR packages of the stored list. - ${B}store${N} - Stores a list of all installed packages on the system. + ${U}list${N} Display all packages installed on the system. + + ${U}store${N} Stores a list of all installed packages on the system. + + The default value is ${U}list${N}. ${B}-l, --pull${N} Pull each added file from the system to the dotfiles directory. @@ -67,6 +67,9 @@ ${B}OPTIONS${N} EOF } +# Exit if no option is provided +[ "$#" -eq 0 ] && help && exit 1 + set_files() { FILES="$(find . -type f -o -type l \ | awk -v e="^./($EXCLUDE_FILES)" '$0 !~ e { print $0 }')"