zsh-workers
 help / color / mirror / code / Atom feed
f8e25f54e415e9970524f8219a7485cad5ae0e3c blob 1315 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
 
# Lets you implement widgets that can execute arbitrary commands without losing
# the current command line, in a fashion similar to the 'run-help' and
# 'which-command' widgets. See the manual for more details.

zmodload -F zsh/zutil b:zparseopts
local -A opts
zparseopts -D -A opts - e s v:

local -a err
zle ||
    err+=( "${0}: can only be called from zle widgets" )
(( # )) ||
    err+=( "${0}: not enough arguments" )
if [[ -n $err ]]; then
  print -lu2 -- $err[@] \
$'Usage: execute-commands [ <options> ] [--] <command> ...
Execute commands from zle widget, without mangling prompt or buffer.
Options:
  -e         echo commands before executing
  -s         save commands to history
  -v <name>  store last command\'s exit status in param <name>'
  return 1
fi

case $CONTEXT in
  ( cont | start )
    print -rz -- "$PREBUFFER$BUFFER"  # Push all lines to buffer stack.
    [[ -v opts[-e] ]] &&
        BUFFER="${(F)@}"              # Echo commands to buffer.
    [[ -v opts[-s] ]] &&
        print -rS -- "${(F)@}"        # Save commands to history.
    eval "${(F)@}"                    # Execute commands.
    local -i ret=$?
    [[ -v opts[-v] ]] &&
        eval "$opts[-v]=$ret"         # Store exit status.
    ;;
  ( * )
    return 75 # EX_TEMPFAIL; see `man 3 sysexits`.
    ;;
esac
zle .send-break
debug log:

solving f8e25f54e ...
found f8e25f54e in https://inbox.vuxu.org/zsh-workers/CAHLkEDt_-WZ4B8T0yh8g3OFASBa2nBsHsdDMc3xYVXGds7G5ag@mail.gmail.com/

applying [1/1] https://inbox.vuxu.org/zsh-workers/CAHLkEDt_-WZ4B8T0yh8g3OFASBa2nBsHsdDMc3xYVXGds7G5ag@mail.gmail.com/
diff --git a/Functions/Zle/execute-command b/Functions/Zle/execute-command
new file mode 100644
index 000000000..f8e25f54e

Checking patch Functions/Zle/execute-command...
Applied patch Functions/Zle/execute-command cleanly.

index at:
100644 f8e25f54e415e9970524f8219a7485cad5ae0e3c	Functions/Zle/execute-command

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).