Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add prompt_pure_system_report for reporting issues #468

Merged
merged 3 commits into from
Jun 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion pure.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -549,12 +549,57 @@ prompt_pure_state_setup() {
[[ $UID -eq 0 ]] && username='%F{white}%n%f%F{242}@%m%f'

typeset -gA prompt_pure_state
prompt_pure_state=(
prompt_pure_state[version]="1.9.0"
prompt_pure_state+=(
username "$username"
prompt "${PURE_PROMPT_SYMBOL:-❯}"
)
}

prompt_pure_system_report() {
setopt localoptions noshwordsplit

print - "- Zsh: $(zsh --version)"
print -n - "- Operating system: "
case "$(uname -s)" in
Darwin) print "$(sw_vers -productName) $(sw_vers -productVersion) ($(sw_vers -buildVersion))";;
*) print "$(uname -s) ($(uname -v))";;
esac
print - "- Terminal program: $TERM_PROGRAM ($TERM_PROGRAM_VERSION)"

local git_version
git_version=($(git --version)) # Remove newlines, if hub is present.
print - "- Git: $git_version"

print - "- Pure state:"
for k v in "${(@kv)prompt_pure_state}"; do
print - "\t- $k: \`${(q)v}\`"
done
print - "- Virtualenv: \`$(typeset -p VIRTUAL_ENV_DISABLE_PROMPT)\`"
print - "- Prompt: \`$(typeset -p PROMPT)\`"

local ohmyzsh=0
typeset -la frameworks
(( $+ANTIBODY_HOME )) && frameworks+=("Antibody")
(( $+ADOTDIR )) && frameworks+=("Antigen")
(( $+ANTIGEN_HS_HOME )) && frameworks+=("Antigen-hs")
(( $+functions[upgrade_oh_my_zsh] )) && {
ohmyzsh=1
frameworks+=("Oh My Zsh")
}
(( $+ZPREZTODIR )) && frameworks+=("Prezto")
(( $+ZPLUG_ROOT )) && frameworks+=("Zplug")
(( $+ZPLGM )) && frameworks+=("Zplugin")

(( $#frameworks == 0 )) && frameworks+=("None")
print - "- Detected frameworks: ${(j:, :)frameworks}"

if (( ohmyzsh )); then
print - "\t- Oh My Zsh:"
print - "\t\t- Plugins: ${(j:, :)plugins}"
fi
}

prompt_pure_setup() {
# Prevent percentage showing up if output doesn't end with a newline.
export PROMPT_EOL_MARK=''
Expand Down