doing 2.0.20 → 2.0.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile.lock +1 -1
  4. data/README.md +1 -1
  5. data/doing.rdoc +1 -1
  6. data/lib/doing/log_adapter.rb +3 -1
  7. data/lib/doing/version.rb +1 -1
  8. data/lib/doing/wwid.rb +19 -8
  9. data/lib/helpers/fzf/.goreleaser.yml +119 -0
  10. data/lib/helpers/fzf/.rubocop.yml +28 -0
  11. data/lib/helpers/fzf/ADVANCED.md +565 -0
  12. data/lib/helpers/fzf/BUILD.md +49 -0
  13. data/lib/helpers/fzf/CHANGELOG.md +1193 -0
  14. data/lib/helpers/fzf/Dockerfile +11 -0
  15. data/lib/helpers/fzf/LICENSE +21 -0
  16. data/lib/helpers/fzf/Makefile +166 -0
  17. data/lib/helpers/fzf/README-VIM.md +486 -0
  18. data/lib/helpers/fzf/README.md +712 -0
  19. data/lib/helpers/fzf/bin/fzf-tmux +233 -0
  20. data/lib/helpers/fzf/doc/fzf.txt +512 -0
  21. data/lib/helpers/fzf/go.mod +17 -0
  22. data/lib/helpers/fzf/go.sum +31 -0
  23. data/lib/helpers/fzf/install +382 -0
  24. data/lib/helpers/fzf/install.ps1 +65 -0
  25. data/lib/helpers/fzf/main.go +14 -0
  26. data/lib/helpers/fzf/man/man1/fzf-tmux.1 +68 -0
  27. data/lib/helpers/fzf/man/man1/fzf.1 +1001 -0
  28. data/lib/helpers/fzf/plugin/fzf.vim +1048 -0
  29. data/lib/helpers/fzf/shell/completion.bash +381 -0
  30. data/lib/helpers/fzf/shell/completion.zsh +329 -0
  31. data/lib/helpers/fzf/shell/key-bindings.bash +96 -0
  32. data/lib/helpers/fzf/shell/key-bindings.fish +172 -0
  33. data/lib/helpers/fzf/shell/key-bindings.zsh +114 -0
  34. data/lib/helpers/fzf/src/LICENSE +21 -0
  35. data/lib/helpers/fzf/src/algo/algo.go +884 -0
  36. data/lib/helpers/fzf/src/algo/algo_test.go +197 -0
  37. data/lib/helpers/fzf/src/algo/normalize.go +492 -0
  38. data/lib/helpers/fzf/src/ansi.go +409 -0
  39. data/lib/helpers/fzf/src/ansi_test.go +427 -0
  40. data/lib/helpers/fzf/src/cache.go +81 -0
  41. data/lib/helpers/fzf/src/cache_test.go +39 -0
  42. data/lib/helpers/fzf/src/chunklist.go +89 -0
  43. data/lib/helpers/fzf/src/chunklist_test.go +80 -0
  44. data/lib/helpers/fzf/src/constants.go +85 -0
  45. data/lib/helpers/fzf/src/core.go +351 -0
  46. data/lib/helpers/fzf/src/history.go +96 -0
  47. data/lib/helpers/fzf/src/history_test.go +68 -0
  48. data/lib/helpers/fzf/src/item.go +44 -0
  49. data/lib/helpers/fzf/src/item_test.go +23 -0
  50. data/lib/helpers/fzf/src/matcher.go +235 -0
  51. data/lib/helpers/fzf/src/merger.go +120 -0
  52. data/lib/helpers/fzf/src/merger_test.go +88 -0
  53. data/lib/helpers/fzf/src/options.go +1691 -0
  54. data/lib/helpers/fzf/src/options_test.go +457 -0
  55. data/lib/helpers/fzf/src/pattern.go +425 -0
  56. data/lib/helpers/fzf/src/pattern_test.go +209 -0
  57. data/lib/helpers/fzf/src/protector/protector.go +8 -0
  58. data/lib/helpers/fzf/src/protector/protector_openbsd.go +10 -0
  59. data/lib/helpers/fzf/src/reader.go +201 -0
  60. data/lib/helpers/fzf/src/reader_test.go +63 -0
  61. data/lib/helpers/fzf/src/result.go +243 -0
  62. data/lib/helpers/fzf/src/result_others.go +16 -0
  63. data/lib/helpers/fzf/src/result_test.go +159 -0
  64. data/lib/helpers/fzf/src/result_x86.go +16 -0
  65. data/lib/helpers/fzf/src/terminal.go +2832 -0
  66. data/lib/helpers/fzf/src/terminal_test.go +638 -0
  67. data/lib/helpers/fzf/src/terminal_unix.go +26 -0
  68. data/lib/helpers/fzf/src/terminal_windows.go +45 -0
  69. data/lib/helpers/fzf/src/tokenizer.go +253 -0
  70. data/lib/helpers/fzf/src/tokenizer_test.go +112 -0
  71. data/lib/helpers/fzf/src/tui/dummy.go +46 -0
  72. data/lib/helpers/fzf/src/tui/light.go +987 -0
  73. data/lib/helpers/fzf/src/tui/light_unix.go +110 -0
  74. data/lib/helpers/fzf/src/tui/light_windows.go +145 -0
  75. data/lib/helpers/fzf/src/tui/tcell.go +721 -0
  76. data/lib/helpers/fzf/src/tui/tcell_test.go +392 -0
  77. data/lib/helpers/fzf/src/tui/ttyname_unix.go +47 -0
  78. data/lib/helpers/fzf/src/tui/ttyname_windows.go +14 -0
  79. data/lib/helpers/fzf/src/tui/tui.go +625 -0
  80. data/lib/helpers/fzf/src/tui/tui_test.go +20 -0
  81. data/lib/helpers/fzf/src/util/atomicbool.go +34 -0
  82. data/lib/helpers/fzf/src/util/atomicbool_test.go +17 -0
  83. data/lib/helpers/fzf/src/util/chars.go +198 -0
  84. data/lib/helpers/fzf/src/util/chars_test.go +46 -0
  85. data/lib/helpers/fzf/src/util/eventbox.go +96 -0
  86. data/lib/helpers/fzf/src/util/eventbox_test.go +61 -0
  87. data/lib/helpers/fzf/src/util/slab.go +12 -0
  88. data/lib/helpers/fzf/src/util/util.go +138 -0
  89. data/lib/helpers/fzf/src/util/util_test.go +40 -0
  90. data/lib/helpers/fzf/src/util/util_unix.go +47 -0
  91. data/lib/helpers/fzf/src/util/util_windows.go +83 -0
  92. data/lib/helpers/fzf/test/fzf.vader +175 -0
  93. data/lib/helpers/fzf/test/test_go.rb +2626 -0
  94. data/lib/helpers/fzf/uninstall +117 -0
  95. metadata +88 -2
@@ -0,0 +1,233 @@
1
+ #!/usr/bin/env bash
2
+ # fzf-tmux: starts fzf in a tmux pane
3
+ # usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
4
+
5
+ fail() {
6
+ >&2 echo "$1"
7
+ exit 2
8
+ }
9
+
10
+ fzf="$(command -v fzf 2> /dev/null)" || fzf="$(dirname "$0")/fzf"
11
+ [[ -x "$fzf" ]] || fail 'fzf executable not found'
12
+
13
+ tmux_args=()
14
+ args=()
15
+ opt=""
16
+ skip=""
17
+ swap=""
18
+ close=""
19
+ term=""
20
+ [[ -n "$LINES" ]] && lines=$LINES || lines=$(tput lines) || lines=$(tmux display-message -p "#{pane_height}")
21
+ [[ -n "$COLUMNS" ]] && columns=$COLUMNS || columns=$(tput cols) || columns=$(tmux display-message -p "#{pane_width}")
22
+
23
+ help() {
24
+ >&2 echo 'usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]
25
+
26
+ LAYOUT OPTIONS:
27
+ (default layout: -d 50%)
28
+
29
+ Popup window (requires tmux 3.2 or above):
30
+ -p [WIDTH[%][,HEIGHT[%]]] (default: 50%)
31
+ -w WIDTH[%]
32
+ -h HEIGHT[%]
33
+ -x COL
34
+ -y ROW
35
+
36
+ Split pane:
37
+ -u [HEIGHT[%]] Split above (up)
38
+ -d [HEIGHT[%]] Split below (down)
39
+ -l [WIDTH[%]] Split left
40
+ -r [WIDTH[%]] Split right
41
+ '
42
+ exit
43
+ }
44
+
45
+ while [[ $# -gt 0 ]]; do
46
+ arg="$1"
47
+ shift
48
+ [[ -z "$skip" ]] && case "$arg" in
49
+ -)
50
+ term=1
51
+ ;;
52
+ --help)
53
+ help
54
+ ;;
55
+ --version)
56
+ echo "fzf-tmux (with fzf $("$fzf" --version))"
57
+ exit
58
+ ;;
59
+ -p*|-w*|-h*|-x*|-y*|-d*|-u*|-r*|-l*)
60
+ if [[ "$arg" =~ ^-[pwhxy] ]]; then
61
+ [[ "$opt" =~ "-K -E" ]] || opt="-K -E"
62
+ elif [[ "$arg" =~ ^.[lr] ]]; then
63
+ opt="-h"
64
+ if [[ "$arg" =~ ^.l ]]; then
65
+ opt="$opt -d"
66
+ swap="; swap-pane -D ; select-pane -L"
67
+ close="; tmux swap-pane -D"
68
+ fi
69
+ else
70
+ opt=""
71
+ if [[ "$arg" =~ ^.u ]]; then
72
+ opt="$opt -d"
73
+ swap="; swap-pane -D ; select-pane -U"
74
+ close="; tmux swap-pane -D"
75
+ fi
76
+ fi
77
+ if [[ ${#arg} -gt 2 ]]; then
78
+ size="${arg:2}"
79
+ else
80
+ if [[ "$1" =~ ^[0-9%,]+$ ]] || [[ "$1" =~ ^[A-Z]$ ]]; then
81
+ size="$1"
82
+ shift
83
+ else
84
+ continue
85
+ fi
86
+ fi
87
+
88
+ if [[ "$arg" =~ ^-p ]]; then
89
+ if [[ -n "$size" ]]; then
90
+ w=${size%%,*}
91
+ h=${size##*,}
92
+ opt="$opt -w$w -h$h"
93
+ fi
94
+ elif [[ "$arg" =~ ^-[whxy] ]]; then
95
+ opt="$opt ${arg:0:2}$size"
96
+ elif [[ "$size" =~ %$ ]]; then
97
+ size=${size:0:((${#size}-1))}
98
+ if [[ -n "$swap" ]]; then
99
+ opt="$opt -p $(( 100 - size ))"
100
+ else
101
+ opt="$opt -p $size"
102
+ fi
103
+ else
104
+ if [[ -n "$swap" ]]; then
105
+ if [[ "$arg" =~ ^.l ]]; then
106
+ max=$columns
107
+ else
108
+ max=$lines
109
+ fi
110
+ size=$(( max - size ))
111
+ [[ $size -lt 0 ]] && size=0
112
+ opt="$opt -l $size"
113
+ else
114
+ opt="$opt -l $size"
115
+ fi
116
+ fi
117
+ ;;
118
+ --)
119
+ # "--" can be used to separate fzf-tmux options from fzf options to
120
+ # avoid conflicts
121
+ skip=1
122
+ tmux_args=("${args[@]}")
123
+ args=()
124
+ continue
125
+ ;;
126
+ *)
127
+ args+=("$arg")
128
+ ;;
129
+ esac
130
+ [[ -n "$skip" ]] && args+=("$arg")
131
+ done
132
+
133
+ if [[ -z "$TMUX" ]]; then
134
+ "$fzf" "${args[@]}"
135
+ exit $?
136
+ fi
137
+
138
+ # --height option is not allowed. CTRL-Z is also disabled.
139
+ args=("${args[@]}" "--no-height" "--bind=ctrl-z:ignore")
140
+
141
+ # Handle zoomed tmux pane without popup options by moving it to a temp window
142
+ if [[ ! "$opt" =~ "-K -E" ]] && tmux list-panes -F '#F' | grep -q Z; then
143
+ zoomed_without_popup=1
144
+ original_window=$(tmux display-message -p "#{window_id}")
145
+ tmp_window=$(tmux new-window -d -P -F "#{window_id}" "bash -c 'while :; do for c in \\| / - '\\;' do sleep 0.2; printf \"\\r\$c fzf-tmux is running\\r\"; done; done'")
146
+ tmux swap-pane -t $tmp_window \; select-window -t $tmp_window
147
+ fi
148
+
149
+ set -e
150
+
151
+ # Clean up named pipes on exit
152
+ id=$RANDOM
153
+ argsf="${TMPDIR:-/tmp}/fzf-args-$id"
154
+ fifo1="${TMPDIR:-/tmp}/fzf-fifo1-$id"
155
+ fifo2="${TMPDIR:-/tmp}/fzf-fifo2-$id"
156
+ fifo3="${TMPDIR:-/tmp}/fzf-fifo3-$id"
157
+ tmux_win_opts=( $(tmux show-window-options remain-on-exit \; show-window-options synchronize-panes | sed '/ off/d; s/^/set-window-option /; s/$/ \\;/') )
158
+ cleanup() {
159
+ \rm -f $argsf $fifo1 $fifo2 $fifo3
160
+
161
+ # Restore tmux window options
162
+ if [[ "${#tmux_win_opts[@]}" -gt 0 ]]; then
163
+ eval "tmux ${tmux_win_opts[*]}"
164
+ fi
165
+
166
+ # Remove temp window if we were zoomed without popup options
167
+ if [[ -n "$zoomed_without_popup" ]]; then
168
+ tmux display-message -p "#{window_id}" > /dev/null
169
+ tmux swap-pane -t $original_window \; \
170
+ select-window -t $original_window \; \
171
+ kill-window -t $tmp_window \; \
172
+ resize-pane -Z
173
+ fi
174
+
175
+ if [[ $# -gt 0 ]]; then
176
+ trap - EXIT
177
+ exit 130
178
+ fi
179
+ }
180
+ trap 'cleanup 1' SIGUSR1
181
+ trap 'cleanup' EXIT
182
+
183
+ envs="export TERM=$TERM "
184
+ [[ "$opt" =~ "-K -E" ]] && FZF_DEFAULT_OPTS="--margin 0,1 $FZF_DEFAULT_OPTS"
185
+ [[ -n "$FZF_DEFAULT_OPTS" ]] && envs="$envs FZF_DEFAULT_OPTS=$(printf %q "$FZF_DEFAULT_OPTS")"
186
+ [[ -n "$FZF_DEFAULT_COMMAND" ]] && envs="$envs FZF_DEFAULT_COMMAND=$(printf %q "$FZF_DEFAULT_COMMAND")"
187
+ echo "$envs;" > "$argsf"
188
+
189
+ # Build arguments to fzf
190
+ opts=$(printf "%q " "${args[@]}")
191
+
192
+ pppid=$$
193
+ echo -n "trap 'kill -SIGUSR1 -$pppid' EXIT SIGINT SIGTERM;" >> $argsf
194
+ close="; trap - EXIT SIGINT SIGTERM $close"
195
+
196
+ export TMUX=$(cut -d , -f 1,2 <<< "$TMUX")
197
+ mkfifo -m o+w $fifo2
198
+ if [[ "$opt" =~ "-K -E" ]]; then
199
+ cat $fifo2 &
200
+ if [[ -n "$term" ]] || [[ -t 0 ]]; then
201
+ cat <<< "\"$fzf\" $opts > $fifo2; out=\$? $close; exit \$out" >> $argsf
202
+ else
203
+ mkfifo $fifo1
204
+ cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; out=\$? $close; exit \$out" >> $argsf
205
+ cat <&0 > $fifo1 &
206
+ fi
207
+
208
+ # tmux dropped the support for `-K`, `-R` to popup command
209
+ # TODO: We can remove this once tmux 3.2 is released
210
+ if [[ ! "$(tmux popup --help 2>&1)" =~ '-R shell-command' ]]; then
211
+ opt="${opt/-K/}"
212
+ else
213
+ opt="${opt} -R"
214
+ fi
215
+
216
+ tmux popup -d "$PWD" "${tmux_args[@]}" $opt "bash $argsf" > /dev/null 2>&1
217
+ exit $?
218
+ fi
219
+
220
+ mkfifo -m o+w $fifo3
221
+ if [[ -n "$term" ]] || [[ -t 0 ]]; then
222
+ cat <<< "\"$fzf\" $opts > $fifo2; echo \$? > $fifo3 $close" >> $argsf
223
+ else
224
+ mkfifo $fifo1
225
+ cat <<< "\"$fzf\" $opts < $fifo1 > $fifo2; echo \$? > $fifo3 $close" >> $argsf
226
+ cat <&0 > $fifo1 &
227
+ fi
228
+ tmux set-window-option synchronize-panes off \;\
229
+ set-window-option remain-on-exit off \;\
230
+ split-window -c "$PWD" $opt "${tmux_args[@]}" "bash -c 'exec -a fzf bash $argsf'" $swap \
231
+ > /dev/null 2>&1 || { "$fzf" "${args[@]}"; exit $?; }
232
+ cat $fifo2
233
+ exit "$(cat $fifo3)"