From 509e95784270c20a51d01a5fd727963351a26c1b Mon Sep 17 00:00:00 2001 From: dbbrowne Date: Tue, 29 Mar 2022 20:18:57 +0100 Subject: [PATCH] doc+feat(webi): update PATH instructions, fix typos --- README.md | 4 ++-- _webi/bootstrap.sh | 15 +++++++-------- _webi/template.sh | 18 ++++++++++++++---- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 7eb295e..2a2af51 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ More technically: - common release APIs are in `_common/` (i.e. `_common/github.js`) 2. `_webi/bootstrap.sh` is a template that exchanges system information for a correct installer - - contructs a user agent with os, cpu, and utility info (i.e. `macos`, + - constructs a user agent with os, cpu, and utility info (i.e. `macos`, `amd64`, can unpack `tar,zip,xz`) 3. `_webi/template.sh` is the base installer template with common functions for - checking versions @@ -185,7 +185,7 @@ pkg_get_current_version() { } ``` -For the rest of the functions you can like copy/paste from the examples: +For the rest of the functions you can copy/paste from the examples: ```bash pkg_format_cmd_version() {} # Override, pretty prints version diff --git a/_webi/bootstrap.sh b/_webi/bootstrap.sh index a4dbf7c..ee707c0 100644 --- a/_webi/bootstrap.sh +++ b/_webi/bootstrap.sh @@ -130,14 +130,13 @@ function __webi_main () { if [ -f "\$_webi_tmp/.PATH.env" ]; then my_paths=\$(cat "\$_webi_tmp/.PATH.env" | sort -u) if [ -n "\$my_paths" ]; then - echo "IMPORTANT: You must update you PATH to use the installed program(s)" - echo "" - echo "You can either" - echo "A) can CLOSE and REOPEN Terminal or" - echo "B) RUN these exports:" - echo "" - echo "\$my_paths" - echo "" + printf 'PATH.env updated with:\\n' + printf "%s\\n" "\$my_paths" + printf '\\n' + printf "\\e[31mTO FINISH\\e[0m: copy, paste & run the following command:\\n" + printf "\\n" + printf " \\e[34msource ~/.config/envman/PATH.env\\e[0m\\n" + printf " (newly opened terminal windows will update automatically)\\n" fi rm -f "\$_webi_tmp/.PATH.env" fi diff --git a/_webi/template.sh b/_webi/template.sh index 373b159..95af4bf 100644 --- a/_webi/template.sh +++ b/_webi/template.sh @@ -244,8 +244,12 @@ function __bootstrap_webi() { # in case pathman was recently installed and the PATH not updated mkdir -p "$_webi_tmp" - # prevent "too few arguments" output on bash when there are 0 lines of stdout - "$HOME/.local/bin/pathman" add "$1" | grep "export" 2> /dev/null >> "$_webi_tmp/.PATH.env" || true + # 'true' to prevent "too few arguments" output on bash + # when there are 0 lines of stdout + "$HOME/.local/bin/pathman" add "$1" | + grep "export" 2> /dev/null \ + >> "$_webi_tmp/.PATH.env" || + true } # group common pre-install tasks as default @@ -404,10 +408,16 @@ function __bootstrap_webi() { webi_path_add "$HOME/.local/bin" if [[ -z ${_WEBI_CHILD:-} ]] && [[ -f "$_webi_tmp/.PATH.env" ]]; then if [[ -n $(cat "$_webi_tmp/.PATH.env") ]]; then - echo "You need to update your PATH to use $PKG_NAME:" - echo "" + printf 'PATH.env updated with:\n' sort -u "$_webi_tmp/.PATH.env" + printf "\n" + rm -f "$_webi_tmp/.PATH.env" + + printf "\e[31mTO FINISH\e[0m: copy, paste & run the following command:\n" + printf "\n" + printf " \e[34msource ~/.config/envman/PATH.env\e[0m\n" + printf " (newly opened terminal windows will update automatically)\n" fi fi