From c6c4a47cf5b4e1880ac97fc5302d1a9a8e3b7814 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Dec 2016 21:19:29 +1100 Subject: [PATCH 1/5] Shell: Rewrite function --- neofetch | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/neofetch b/neofetch index f2d34bd0..d65082c5 100755 --- a/neofetch +++ b/neofetch @@ -494,38 +494,28 @@ get_packages() { get_shell() { case "$shell_path" in - "on") shell="$SHELL" ;; - "off") shell="${SHELL##*/}" ;; + "on") shell="$SHELL " ;; + "off") shell="${SHELL##*/} " ;; esac if [[ "$shell_version" == "on" ]]; then - shell+=" " case "${SHELL##*/}" in - "bash") - shell+=" ${BASH_VERSION/-*}" - ;; + "bash") shell+="${BASH_VERSION/-*}" ;; - "zsh") - shell+="$(zsh --version)" - shell="${shell/ zsh}" + "fish" | "zsh" | "tcsh" | "csh") + shell+="$("$SHELL" --version)" + shell="${shell/${SHELL##*/}}" ;; "mksh" | "ksh") shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" shell="${shell/ * KSH}" ;; - - "tcsh" | "csh") - shell+="$("$SHELL" --version)" - shell="${shell/tcsh}" - shell="${shell/\(*}" - ;; - - "fish") - shell+="$(fish --version)" - shell="${shell/fish, version}" - ;; esac + + # Remove unwanted info + shell="${shell/, version}" + shell="${shell/options*}" shell="${shell/\(*\)}" fi } From d1cd0fd74162e2a54a757c6701b57a5b189f1611 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Dec 2016 21:44:02 +1100 Subject: [PATCH 2/5] Shell: Cut 'version' from ksh output --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index d65082c5..4d9ddbf6 100755 --- a/neofetch +++ b/neofetch @@ -510,6 +510,7 @@ get_shell() { "mksh" | "ksh") shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" shell="${shell/ * KSH}" + shell="${shell/Version}" ;; esac From cd9b9bb00bb5bc3d7a7d33c1175866f7a743a477 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Dec 2016 21:54:04 +1100 Subject: [PATCH 3/5] Shell: [ksh] Use --version --- neofetch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/neofetch b/neofetch index 4d9ddbf6..51bbb759 100755 --- a/neofetch +++ b/neofetch @@ -502,20 +502,20 @@ get_shell() { case "${SHELL##*/}" in "bash") shell+="${BASH_VERSION/-*}" ;; - "fish" | "zsh" | "tcsh" | "csh") - shell+="$("$SHELL" --version)" + "fish" | "zsh" | "tcsh" | "csh" | "ksh") + shell+="$("$SHELL" --version 2>&1)" shell="${shell/${SHELL##*/}}" ;; - "mksh" | "ksh") + "mksh") shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" shell="${shell/ * KSH}" - shell="${shell/Version}" ;; esac # Remove unwanted info shell="${shell/, version}" + shell="${shell/version * sh/ksh}" shell="${shell/options*}" shell="${shell/\(*\)}" fi From 91825d4bc7852443a52ce796cc9bd4ce2bc0d4fb Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Dec 2016 22:02:32 +1100 Subject: [PATCH 4/5] Shell: Add support for xonsh --- neofetch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/neofetch b/neofetch index 51bbb759..653a6e43 100755 --- a/neofetch +++ b/neofetch @@ -502,7 +502,7 @@ get_shell() { case "${SHELL##*/}" in "bash") shell+="${BASH_VERSION/-*}" ;; - "fish" | "zsh" | "tcsh" | "csh" | "ksh") + "fish" | "zsh" | "tcsh" | "csh" | "ksh" | "xonsh") shell+="$("$SHELL" --version 2>&1)" shell="${shell/${SHELL##*/}}" ;; @@ -516,6 +516,7 @@ get_shell() { # Remove unwanted info shell="${shell/, version}" shell="${shell/version * sh/ksh}" + shell="${shell/xonsh\//xonsh }" shell="${shell/options*}" shell="${shell/\(*\)}" fi From 844720f85a7cc55c594ab5a9b554ff5beba05076 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Thu, 15 Dec 2016 22:27:13 +1100 Subject: [PATCH 5/5] Shell: Make all other shells use --version --- neofetch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index 653a6e43..0c130659 100755 --- a/neofetch +++ b/neofetch @@ -502,15 +502,15 @@ get_shell() { case "${SHELL##*/}" in "bash") shell+="${BASH_VERSION/-*}" ;; - "fish" | "zsh" | "tcsh" | "csh" | "ksh" | "xonsh") - shell+="$("$SHELL" --version 2>&1)" - shell="${shell/${SHELL##*/}}" - ;; - "mksh") shell+="$("$SHELL" -c 'printf "%s" "$KSH_VERSION"')" shell="${shell/ * KSH}" ;; + + *) + shell+="$("$SHELL" --version 2>&1)" + shell="${shell/${SHELL##*/}}" + ;; esac # Remove unwanted info