lexdrill 0.24.0 → 0.26.1
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 +8 -7
- data/lib/lexdrill/cli.rb +18 -6
- data/lib/lexdrill/http_client.rb +9 -1
- data/lib/lexdrill/line_formatter.rb +5 -5
- data/lib/lexdrill/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d3dc4600b6ad7303df0b607b7b9ded50b00cf4b3a7ca98e4fa05ca0e1663121
|
|
4
|
+
data.tar.gz: 90c8bedb7c4145f633b88506cd190f840ec9f87b5bbc1286803aa264da56eb8d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3d24e21d27f2b7bfbba4fdd738adce07c6a7006e53334fde2a9e061351c15da86b3e1f7b24e5dc90828e4aa0577af0669eec4d331fa3d36ae1abaa9ba31e998
|
|
7
|
+
data.tar.gz: 4558b0d82b02be2c20a7921c741ca066d857f3aa43cdfa006318647dc709757ff360fbba0a0cdafb160254311fb8a43486e491e033a85b8a4ab68260b165039e
|
data/README.md
CHANGED
|
@@ -48,11 +48,11 @@ starter list (a set of NLP presuppositions) the first time it runs, so
|
|
|
48
48
|
there's always something to drill.
|
|
49
49
|
|
|
50
50
|
Run `drill next` to print the current word and advance to the next one.
|
|
51
|
-
Output is `counter/total` (the word's own 1-based
|
|
52
|
-
|
|
53
|
-
its show count — see "Mastery" below), all on one line:
|
|
51
|
+
Output is the drill sign and `counter/total` (the word's own 1-based
|
|
52
|
+
position in the list), together in yellow, a space, then the word (colored
|
|
53
|
+
by its show count — see "Mastery" below), all on one line:
|
|
54
54
|
```
|
|
55
|
-
1/6
|
|
55
|
+
⟳1/6 apple
|
|
56
56
|
```
|
|
57
57
|
(word 1 of 6 total)
|
|
58
58
|
|
|
@@ -299,7 +299,7 @@ drill sh
|
|
|
299
299
|
drill sh use Sheet1
|
|
300
300
|
```
|
|
301
301
|
|
|
302
|
-
`drill sh` (or `drill sh index`) lists the tabs in the active workbook,
|
|
302
|
+
`drill sh` (or `drill sh index`, or `drill ls`) lists the tabs in the active workbook,
|
|
303
303
|
marking the active one with the drill sign (⟳). `drill sh use <name>`
|
|
304
304
|
switches to a tab **and immediately pulls it** — replacing your local
|
|
305
305
|
word list with that tab's column A. `drill sh add <name>` creates a new,
|
|
@@ -338,14 +338,15 @@ stderr; the word is still added locally either way.
|
|
|
338
338
|
| `drill polka\|waltz\|rock\|jazz\|jiga\|balkan\|samba <repetitions>` | Shorthand for a fixed loop size (see table above) |
|
|
339
339
|
| `drill color random\|default` | Color each shown word randomly, or by its show count (`default`) |
|
|
340
340
|
| `drill add <text>` | Append a new item to the end of the list; also pushes to the active tab, if one is selected |
|
|
341
|
-
| `drill list` | Show how many times each item has been shown, numbered |
|
|
341
|
+
| `drill list` | Show how many times each item has been shown, numbered (`drill all` also works) |
|
|
342
342
|
| `drill edit` | Open the list file in `$EDITOR`/`$VISUAL` (falls back to `vi`) |
|
|
343
343
|
| `drill stats` | Print all items as `<count>\t<phrase>` (tab-separated), sorted by show count, highest first |
|
|
344
344
|
| `drill rand <n>` | `drill next` shows a word ~1-in-`n` times (`n=1` is every time, the default) |
|
|
345
345
|
| `drill go <number>` | Jump so the next `drill next` shows item `<number>` (1-based, see `drill list`) — prints nothing itself; refuses a graduated item; has no effect while `drill beat rand` is active, since that mode ignores the counter entirely |
|
|
346
346
|
| `drill remote` / `drill oauth` | Choose the Google Sheets auth mode: local service account key, or personal OAuth login (global, applies to every workbook) |
|
|
347
347
|
| `drill wb` / `wb index` / `add <url>` / `remove <name>` / `use <name>` | List (bare `drill wb` is an alias for `wb index`)/add/forget/switch known workbooks; `add` names the workbook after the spreadsheet's own title; the active one is marked with the drill sign |
|
|
348
|
-
| `drill sh` / `sh index` / `add <name>` / `remove <name>` / `use <name>` | List (
|
|
348
|
+
| `drill sh` / `drill ls` / `sh index` / `add <name>` / `remove <name>` / `use <name>` | List (`drill sh`/`drill ls` are aliases for `sh index`)/create/delete/switch tabs in the active workbook; `use` also pulls the tab's contents; the active one is marked with the drill sign |
|
|
349
|
+
| `drill use <name>` | Alias for `drill sh use <name>` |
|
|
349
350
|
| `drill open` | Open the active tab in your default browser |
|
|
350
351
|
| `drill push` | Overwrite the active tab with the current word list text |
|
|
351
352
|
| `drill pull` | Replace the local word list with column A of the active tab |
|
data/lib/lexdrill/cli.rb
CHANGED
|
@@ -13,7 +13,7 @@ class Lexdrill::CLI
|
|
|
13
13
|
run_beat_alias: %w[polka waltz rock jazz jiga balkan samba],
|
|
14
14
|
run_color: %w[color],
|
|
15
15
|
run_add: %w[add],
|
|
16
|
-
run_list: %w[list],
|
|
16
|
+
run_list: %w[list all],
|
|
17
17
|
run_edit: %w[edit],
|
|
18
18
|
run_stats: %w[stats],
|
|
19
19
|
run_rand: %w[rand],
|
|
@@ -21,7 +21,8 @@ class Lexdrill::CLI
|
|
|
21
21
|
run_remote: %w[remote],
|
|
22
22
|
run_oauth: %w[oauth],
|
|
23
23
|
run_wb: %w[wb],
|
|
24
|
-
run_sh: %w[sh],
|
|
24
|
+
run_sh: %w[sh ls],
|
|
25
|
+
run_use: %w[use],
|
|
25
26
|
run_open: %w[open],
|
|
26
27
|
run_push: %w[push],
|
|
27
28
|
run_pull: %w[pull]
|
|
@@ -71,7 +72,7 @@ class Lexdrill::CLI
|
|
|
71
72
|
Shorthand for a fixed loop size (2 through 8, in order)
|
|
72
73
|
drill color random|default Color each word randomly, or by its show count (default)
|
|
73
74
|
drill add <text> Append a new item to the list (and push, if a sheet is selected)
|
|
74
|
-
drill list Show how many times each item has been shown
|
|
75
|
+
drill list Show how many times each item has been shown (drill all also works)
|
|
75
76
|
drill edit Open the list file in $EDITOR/$VISUAL (falls back to vi)
|
|
76
77
|
drill stats Print items as <count>\t<phrase>, tab-separated, highest count first
|
|
77
78
|
drill rand <n> drill next shows a word ~1-in-n times (n=1 is every time)
|
|
@@ -84,11 +85,12 @@ class Lexdrill::CLI
|
|
|
84
85
|
drill wb add <url> Add a workbook by URL (named after its own title)
|
|
85
86
|
drill wb remove <name> Forget a workbook
|
|
86
87
|
drill wb use <name> Switch the active workbook
|
|
87
|
-
drill sh Alias for drill sh index
|
|
88
|
+
drill sh Alias for drill sh index (drill ls also works)
|
|
88
89
|
drill sh index List the tabs in the active workbook
|
|
89
90
|
drill sh add <name> Create a new tab
|
|
90
91
|
drill sh remove <name> Delete a tab
|
|
91
92
|
drill sh use <name> Switch the active tab (pulls its contents)
|
|
93
|
+
drill use <name> Alias for drill sh use <name>
|
|
92
94
|
drill open Open the active tab in your browser
|
|
93
95
|
drill push Push the word list text to the active tab (overwrites it)
|
|
94
96
|
drill pull Replace the local word list with the active tab's column A
|
|
@@ -582,7 +584,17 @@ class Lexdrill::CLI
|
|
|
582
584
|
end
|
|
583
585
|
|
|
584
586
|
def run_sh_use
|
|
585
|
-
|
|
587
|
+
use_sheet(argv[2])
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
# `drill use <name>` is a shortcut for `drill sh use <name>` — the name
|
|
591
|
+
# sits at a different argv position, so this and run_sh_use share the
|
|
592
|
+
# same underlying logic rather than duplicating it.
|
|
593
|
+
def run_use
|
|
594
|
+
use_sheet(argv[1])
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
def use_sheet(name)
|
|
586
598
|
return print_sh_use_usage unless name
|
|
587
599
|
|
|
588
600
|
spreadsheet_id = Lexdrill::Workbooks.current_id
|
|
@@ -611,7 +623,7 @@ class Lexdrill::CLI
|
|
|
611
623
|
end
|
|
612
624
|
|
|
613
625
|
def print_sh_use_usage
|
|
614
|
-
warn "usage: drill sh use <name>"
|
|
626
|
+
warn "usage: drill sh use <name> (or drill use <name>)"
|
|
615
627
|
1
|
|
616
628
|
end
|
|
617
629
|
|
data/lib/lexdrill/http_client.rb
CHANGED
|
@@ -18,9 +18,17 @@ module Lexdrill::HTTPClient
|
|
|
18
18
|
|
|
19
19
|
class NetworkError < StandardError; end
|
|
20
20
|
|
|
21
|
+
# Net::HTTP's 2-arg instance `#post(path, body)` sends no Content-Type
|
|
22
|
+
# header at all — most token endpoints tolerate that (defaulting to
|
|
23
|
+
# form-urlencoded), but not all do, so this sets it explicitly.
|
|
21
24
|
def self.post_form(url, params)
|
|
22
25
|
uri = URI(url)
|
|
23
|
-
perform(uri)
|
|
26
|
+
perform(uri) do |http|
|
|
27
|
+
request = Net::HTTP::Post.new(uri.request_uri)
|
|
28
|
+
request["Content-Type"] = "application/x-www-form-urlencoded"
|
|
29
|
+
request.body = URI.encode_www_form(params)
|
|
30
|
+
http.request(request)
|
|
31
|
+
end
|
|
24
32
|
end
|
|
25
33
|
|
|
26
34
|
def self.json_post(url, body:, headers: {})
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Formats a shown word for display, on one line:
|
|
4
|
-
# "{index}/{total}
|
|
4
|
+
# "{SEPARATOR}{index}/{total} {word}" — index is the word's own 1-based
|
|
5
5
|
# position in the list, re-derived through Lexdrill::Beat so it stays
|
|
6
|
-
# meaningful even when a rhythm repeats steps. The
|
|
7
|
-
#
|
|
8
|
-
# show count (see Lexdrill::Colorizer).
|
|
6
|
+
# meaningful even when a rhythm repeats steps. The separator and
|
|
7
|
+
# counter/total are painted yellow, as one unit; the word is colored by
|
|
8
|
+
# its show count (see Lexdrill::Colorizer).
|
|
9
9
|
module Lexdrill::LineFormatter
|
|
10
10
|
SEPARATOR = "⟳"
|
|
11
11
|
|
|
12
12
|
def self.format(word)
|
|
13
13
|
total = Lexdrill::WordList.words.size
|
|
14
14
|
count = Lexdrill::Stats.counts.fetch(word, 0)
|
|
15
|
-
prefix = Lexdrill::Colorizer.paint_yellow("#{loop_index(total) + 1}/#{total}
|
|
15
|
+
prefix = Lexdrill::Colorizer.paint_yellow("#{SEPARATOR}#{loop_index(total) + 1}/#{total}")
|
|
16
16
|
"#{prefix} #{Lexdrill::Colorizer.paint_by_count(word, count)}"
|
|
17
17
|
end
|
|
18
18
|
|
data/lib/lexdrill/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lexdrill
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.26.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Siarhei Kisliak
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: lexdrill prints a vocabulary word or phrase on demand, tracking how often
|
|
14
14
|
each one has been shown.
|