lexdrill 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +11 -0
- data/lib/lexdrill/shell_snippet.rb +11 -4
- data/lib/lexdrill/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5cc865e919348867e13b05201ac159f40f7f7fce166f44d31b98cd92d0db757b
|
|
4
|
+
data.tar.gz: c3a93dc3474fe2cafcddb60d4cd25ee3350e66c4f487c8f99878a9d09e71f01f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: df405a270f001707c86ad9e9e0d3104bb822e3eb337c7ab6afb0ad3a320aaf4fece4b1f727ccabfaf09f3fc804903876012f1ef348dd613473aeb962b2a1cbd4
|
|
7
|
+
data.tar.gz: 6849d9d157bd2c634f5687b4ac194bf3d38b2357092d1344ebc38533708723009d52e93a4445988aafe36fcfa3a61b1ec589716588c925f9115fe9d0571f0ae0
|
data/README.md
CHANGED
|
@@ -110,6 +110,17 @@ everything looks correctly configured.
|
|
|
110
110
|
hook block above, so it runs first) instead of relying on it only being in
|
|
111
111
|
`~/.zlogin` / `~/.bash_profile`. It's safe to leave it in both places.
|
|
112
112
|
|
|
113
|
+
#### Word only shows once per session, then stops (bash)
|
|
114
|
+
|
|
115
|
+
The bash hook works by appending a `$(drill_precmd)` command substitution to
|
|
116
|
+
`PS1`, which bash re-evaluates on every prompt render — this is deliberate,
|
|
117
|
+
since some environments (notably Google Cloud Shell's `bashrc.google`)
|
|
118
|
+
snapshot and unconditionally overwrite `PROMPT_COMMAND` after your `.bashrc`
|
|
119
|
+
runs, silently dropping anything hooked in that way. If you installed an
|
|
120
|
+
older version of the hook and see the word print exactly once and never
|
|
121
|
+
again, re-run `drill hook bash` and update the line in your `.bashrc` to the
|
|
122
|
+
current snippet.
|
|
123
|
+
|
|
113
124
|
### Rhythm (`beat`)
|
|
114
125
|
|
|
115
126
|
By default `next` just advances one word at a time. You can instead have it
|
|
@@ -12,14 +12,21 @@ module Lexdrill::ShellSnippet
|
|
|
12
12
|
fi
|
|
13
13
|
SNIPPET
|
|
14
14
|
|
|
15
|
+
# Hooks via PS1 (re-evaluated on every prompt) rather than PROMPT_COMMAND,
|
|
16
|
+
# since some environments (e.g. Google Cloud Shell's bashrc.google) snapshot
|
|
17
|
+
# and overwrite PROMPT_COMMAND after the fact, silently dropping anything
|
|
18
|
+
# appended to it. Output goes straight to /dev/tty so the word is never
|
|
19
|
+
# captured into the PS1 string itself (which would need readline's `\[..\]`
|
|
20
|
+
# non-printing markers to avoid cursor/line-wrap glitches from the color
|
|
21
|
+
# codes).
|
|
15
22
|
BASH = <<~SNIPPET
|
|
16
23
|
drill_precmd() {
|
|
17
24
|
[ -f "$HOME/.drill.disabled" ] && return
|
|
18
|
-
command drill next 2>/dev/null
|
|
25
|
+
command drill next >/dev/tty 2>/dev/null
|
|
19
26
|
}
|
|
20
|
-
case "
|
|
21
|
-
*
|
|
22
|
-
*)
|
|
27
|
+
case "$PS1" in
|
|
28
|
+
*'$(drill_precmd)'*) ;;
|
|
29
|
+
*) PS1="${PS1}"'$(drill_precmd)' ;;
|
|
23
30
|
esac
|
|
24
31
|
SNIPPET
|
|
25
32
|
|
data/lib/lexdrill/version.rb
CHANGED