zsh-workers
 help / color / mirror / code / Atom feed
5141d80e229065305d436ba1222c72fdc87c3add blob 2034 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
#autoload

# Complete history-style modifiers; the first : will have
# been matched and compset -p 1'd.
# The single argument is the type of context:
#   h  history
#   q  glob qualifier
#   p  parameter

local -a list

local type=$1 delim expl
integer global

while true; do
  if [[ -n $PREFIX ]]; then
    local char=$PREFIX[1]

    global=0
    compset -p 1
    case $char in
      ([hretpqQxlu\&])
      # single character modifiers
      ;;

      (s)
      # match delimiter string delimiter string delimiter
      if [[ -z $PREFIX ]]; then
	_delimiters modifier-s
	return
      fi
      delim=$PREFIX[1]
      compset -p 1
      if ! compset -P "[^${delim}]#${delim}[^${delim}]#${delim}"; then
	if compset -P "[^${delim}]#${delim}"; then
	  _message "replacement string"
	else
	  _message "original string"
	fi
	return
      fi
      ;;

      (g)
      global=1
      continue
      ;;
    esac

    # modifier completely matched, see what's next.
    compset -P : && continue
    # if there's something other than colon next, bummer
    [[ -n $PREFIX ]] && return 1

    list=("\::modifier")
    [[ $type = q ]] && list+=("):end of qualifiers")
    # strictly we want a normal suffix if end of qualifiers
    _describe -t delimiters "delimiter" list -Q -S ''
    return
  else
    list=(
      "s:substitute string"
      "&:repeat substitution"
      )
    if (( ! global )); then
      list+=(
	"a:absolute path, resolve '..' logically"
	"A:same, then resolve symlinks"
	"c:PATH search for command"
	"g:globally apply s or &"
	"h:head - strip trailing path element"
	"t:tail - strip directories"
	"r:root - strip suffix"
	"e:leave only extension"
	"Q:strip quotes"
	"P:realpath, resolve '..' physically"
	"l:lower case all words"
	"u:upper case all words"
	)
      [[ $type = h ]] && list+=(
	"p:print without executing"
	"x:quote words, breaking on whitespace"
	)
      [[ $type = [hp] ]] && list+=("q:quote to escape further substitutions")
    fi
    _describe -t modifiers "modifier" list -Q -S ''
    return
  fi
done
debug log:

solving e25dc9a ...
found e25dc9a in https://inbox.vuxu.org/zsh-workers/1471391679-9604-1-git-send-email-danielsh@tarsus.local2/
found 658f9f3 in https://git.vuxu.org/mirror/zsh/
preparing index
index prepared:
100644 658f9f34642095bf22abbfc44706a69fdb9d3016	Completion/Zsh/Type/_history_modifiers

applying [1/1] https://inbox.vuxu.org/zsh-workers/1471391679-9604-1-git-send-email-danielsh@tarsus.local2/
diff --git a/Completion/Zsh/Type/_history_modifiers b/Completion/Zsh/Type/_history_modifiers
index 658f9f3..e25dc9a 100644

Checking patch Completion/Zsh/Type/_history_modifiers...
Applied patch Completion/Zsh/Type/_history_modifiers cleanly.

index at:
100644 5141d80e229065305d436ba1222c72fdc87c3add	Completion/Zsh/Type/_history_modifiers

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).