From eb9da89ad9a8bd886e43c7f1d907495c5a48acc5 Mon Sep 17 00:00:00 2001 From: romkatv Date: Sat, 1 Feb 2020 22:03:42 +0100 Subject: [PATCH] quote $foo when running with unknown options; fixes #453 --- internal/configure.zsh | 2 +- internal/p10k.zsh | 26 +++++++++++++------------- internal/parser.zsh | 2 +- internal/worker.zsh | 4 ++-- powerlevel10k.zsh-theme | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/internal/configure.zsh b/internal/configure.zsh index 588dd02a..8a21c639 100644 --- a/internal/configure.zsh +++ b/internal/configure.zsh @@ -59,7 +59,7 @@ function _p9k_can_configure() { } function p9k_configure() { - eval $__p9k_intro + eval "$__p9k_intro" ( set -- -f source $__p9k_root_dir/internal/wizard.zsh diff --git a/internal/p10k.zsh b/internal/p10k.zsh index 55922b90..57a6ded6 100644 --- a/internal/p10k.zsh +++ b/internal/p10k.zsh @@ -1,4 +1,4 @@ -if [[ $__p9k_sourced != 3 ]]; then +if [[ $__p9k_sourced != 4 ]]; then >&2 print -P "" >&2 print -P "[%F{1}ERROR%f]: Corrupted powerlevel10k installation." >&2 print -P "" @@ -112,7 +112,7 @@ typeset -grA __p9k_colors=( # # Type `getColorCode background` or `getColorCode foreground` to see the list of predefined colors. function getColorCode() { - eval $__p9k_intro + eval "$__p9k_intro" if (( ARGC == 1 )); then case $1 in foreground) @@ -139,7 +139,7 @@ function getColorCode() { # Sadly, this is a part of public API. Its use is emphatically discouraged. function print_icon() { - eval $__p9k_intro + eval "$__p9k_intro" (( $+functions[_p9k_print_icon] )) || source "${__p9k_root_dir}/internal/icons.zsh" _p9k_print_icon "$@" } @@ -150,7 +150,7 @@ function print_icon() { # otherwise "print_icon" is used, which takes the users # overrides into account. function get_icon_names() { - eval $__p9k_intro + eval "$__p9k_intro" (( $+functions[_p9k_get_icon_names] )) || source "${__p9k_root_dir}/internal/icons.zsh" _p9k_get_icon_names "$@" } @@ -3589,7 +3589,7 @@ function _p9k_maybe_ignore_git_repo() { } function _p9k_vcs_resume() { - eval $__p9k_intro + eval "$__p9k_intro" _p9k_maybe_ignore_git_repo @@ -5215,7 +5215,7 @@ function _p9k_on_expand() { (( _p9k__expanded && ! $+__p9k_instant_prompt_active )) && return () { - eval $__p9k_intro + eval "$__p9k_intro" _p9k_maybe_dump (( $+__p9k_instant_prompt_active )) && _p9k_clear_instant_prompt @@ -5305,7 +5305,7 @@ function _p9k_on_expand() { functions -M _p9k_on_expand _p9k_precmd_impl() { - eval $__p9k_intro + eval "$__p9k_intro" (( __p9k_enabled )) || return @@ -5404,7 +5404,7 @@ _p9k_precmd_impl() { _p9k_trapint() { if (( __p9k_enabled )); then - eval $__p9k_intro + eval "$__p9k_intro" zle && _p9k_on_widget_zle-line-finish int fi return 0 @@ -6023,7 +6023,7 @@ function _p9k_widget_hook() { fi fi - eval $__p9k_intro + eval "$__p9k_intro" (( _p9k__restore_prompt_fd )) && _p9k_restore_prompt $_p9k__restore_prompt_fd __p9k_reset_state=1 local pat idx var @@ -6097,7 +6097,7 @@ function _p9k_wrap_widgets() { } function _p9k_restore_prompt() { - eval $__p9k_intro + eval "$__p9k_intro" { (( _p9k__must_restore_prompt )) || return _p9k__must_restore_prompt=0 @@ -6891,7 +6891,7 @@ _p9k_setup() { prompt_opts+=cr fi - eval $__p9k_intro + eval "$__p9k_intro" prompt_powerlevel9k_teardown __p9k_enabled=1 typeset -ga preexec_functions=(_p9k_preexec1 $preexec_functions _p9k_preexec2) @@ -6901,7 +6901,7 @@ _p9k_setup() { prompt_powerlevel9k_setup() { _p9k_setup } prompt_powerlevel9k_teardown() { - eval $__p9k_intro + eval "$__p9k_intro" add-zsh-hook -D precmd '(_p9k_|powerlevel9k_)*' add-zsh-hook -D preexec '(_p9k_|powerlevel9k_)*' PROMPT='%m%# ' @@ -7069,7 +7069,7 @@ typeset -gi __p9k_reset_state function p10k() { [[ $# != 1 || $1 != finalize ]] || { p10k-instant-prompt-finalize; return 0 } - eval $__p9k_intro + eval "$__p9k_intro" if (( !ARGC )); then print -rP -- $__p9k_p10k_usage >&2 diff --git a/internal/parser.zsh b/internal/parser.zsh index 1f5d6eb3..7fe96abd 100644 --- a/internal/parser.zsh +++ b/internal/parser.zsh @@ -141,7 +141,7 @@ function _p9k_parse_buffer() { local rcquotes [[ -o rcquotes ]] && rcquotes=rcquotes - eval $__p9k_intro + eval "$__p9k_intro" setopt no_nomatch $rcquotes typeset -ga P9K_COMMANDS=() diff --git a/internal/worker.zsh b/internal/worker.zsh index 518b34fd..6b369740 100644 --- a/internal/worker.zsh +++ b/internal/worker.zsh @@ -85,7 +85,7 @@ function _p9k_worker_invoke() { } function _p9k_worker_cleanup() { - eval $__p9k_intro + eval "$__p9k_intro" [[ $_p9k__worker_shell_pid == $sysparams[pid] ]] && _p9k_worker_stop return 0 } @@ -106,7 +106,7 @@ function _p9k_worker_stop() { } function _p9k_worker_receive() { - eval $__p9k_intro + eval "$__p9k_intro" [[ -z $_p9k__worker_resp_fd ]] && return diff --git a/powerlevel10k.zsh-theme b/powerlevel10k.zsh-theme index c81da2f9..fd01648a 100644 --- a/powerlevel10k.zsh-theme +++ b/powerlevel10k.zsh-theme @@ -26,7 +26,7 @@ [[ -z $_p9k_locale ]] || local LC_ALL=$_p9k_locale' () { - eval $__p9k_intro + eval "$__p9k_intro" if (( $+__p9k_sourced )); then (( $+functions[_p9k_setup] )) && _p9k_setup return 0 @@ -35,7 +35,7 @@ if [[ $__p9k_dump_file != $__p9k_instant_prompt_dump_file ]] && (( ! $+functions[_p9k_preinit] )) && source $__p9k_dump_file 2>/dev/null && (( $+functions[_p9k_preinit] )); then _p9k_preinit fi - typeset -gr __p9k_sourced=3 + typeset -gr __p9k_sourced=4 if [[ -w $__p9k_root_dir && -w $__p9k_root_dir/internal && -w $__p9k_root_dir/gitstatus && ${(%):-%#} == % ]]; then local f for f in $__p9k_root_dir/{powerlevel9k.zsh-theme,powerlevel10k.zsh-theme,internal/p10k.zsh,internal/icons.zsh,internal/configure.zsh,internal/worker.zsh,internal/parser.zsh,gitstatus/gitstatus.plugin.zsh}; do