wkcheck 0.0.9 → 0.0.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40d8d23291afd61aa33db1fb966363ed12c5dfcd
4
- data.tar.gz: 88888eaf9efcbbdc0c2d599ead371b509799ebde
3
+ metadata.gz: 49a75e9814e96dffe5dbb245568a5a2924a0051d
4
+ data.tar.gz: 67470477e02214362abbe785c666d767d6bca41e
5
5
  SHA512:
6
- metadata.gz: 9e68116d25755b19b96116e4428f64d34264e17d18fd108cac1b7e9ec3cee51799707c016fcf8513b21fc390acb6dc02c82acd8445d86f4bdc186875f5b7dbe9
7
- data.tar.gz: 72a03f419d8c34858f0e2f707592d1f320f8e767760078529995c320ad3aa08c732c2ef4cbb766552e37e1feefcc7b437a1a8feead5e4cf080ed951ec59a6696
6
+ metadata.gz: 433529edfcf2870e6eb78a4ff59c795e80bbdb4eae8b20090f5fe43960ff085baca7f0f8d08cc1b49e2e86a643f50d121d7562d2ca5fe7322f5354203682bf4f
7
+ data.tar.gz: a5d9b39729a72c559fbcecb0d7ae9872f3a895e55553baf093166289c33cf52cd37ded76513265e9def5eb1b28b40e30315a80607f208871e72c51791a2a1e44
data/README.md CHANGED
@@ -71,6 +71,27 @@ Your Critical Items - Max percentage: 85 (Kanji, Radicals, Vocabulary):
71
71
  商売 (しょうばい) - business, commerce
72
72
  ```
73
73
 
74
+ ### Random Kanji / Random Word
75
+
76
+ Displays information for a random kanji or word from WaniKani's database. It goes through all levels, not just
77
+ your current level.
78
+
79
+ ```
80
+ $ wkcheck -k
81
+ Your random kanji is 肌
82
+ Level: 45
83
+ Meaning: skin
84
+ Reading (kunyomi): はだ
85
+ ```
86
+
87
+ ```
88
+ $ wkcheck -w
89
+ Your random word is 彩る
90
+ Level: 48
91
+ Meaning: to color something, to colour something, to color, to colour
92
+ Reading: いろどる
93
+ ```
94
+
74
95
  ## Contributing
75
96
 
76
97
  I'll be super-happy if you guys help giving back! If you want to do some hacking on wkcheck for your needs, this is a good guideline to get started:
data/bin/wkcheck CHANGED
@@ -11,8 +11,10 @@ opts = Slop.parse(help: true) do
11
11
 
12
12
  on "api-key=", "Saves your WaniKani API Key to #{WKCheck::CONFIG_FILE}"
13
13
  on "q", "queue", "Displays your current study queue (new lessons / pending reviews)"
14
- on "l", "level", "Displays your current level progression (radicals / Kanji)"
14
+ on "l", "level", "Displays your current level progression (radicals / kanji)"
15
15
  on "c", "critical", "Displays your current critical items, with an optional argument to set the maximum percentage", argument: :optional
16
+ on "k", "kanji", "Displays information of a randomly selected kanji"
17
+ on "w", "word", "Displays information of a randomly selected vocabulary word"
16
18
  on "v", "version", "Show version number and quit" do
17
19
  puts "wkcheck #{WKCheck::VERSION}"
18
20
  exit
@@ -62,5 +64,17 @@ if opts.critical?
62
64
  end
63
65
  end
64
66
 
67
+ if opts.kanji?
68
+ stats = WKCheck::Stats.new
69
+ puts stats.random_kanji
70
+ exit
71
+ end
72
+
73
+ if opts.word?
74
+ stats = WKCheck::Stats.new
75
+ puts stats.random_word
76
+ exit
77
+ end
78
+
65
79
  # No flags / Invalid flags - Display the help.
66
80
  puts opts.help
data/lib/wkcheck/stats.rb CHANGED
@@ -21,6 +21,22 @@ module WKCheck
21
21
  message += progression_message(progress, "kanji")
22
22
  end
23
23
 
24
+ def random_kanji
25
+ random_kanji = Wanikani::Level.kanji(random_level).sample
26
+ message = Rainbow("Your random kanji is ").bright + Rainbow(random_kanji['character']).bright.underline + "\n"
27
+ message += Rainbow("Level: ").bright + random_kanji['level'].to_s + "\n"
28
+ message += Rainbow("Meaning: ").bright + random_kanji['meaning'] + "\n"
29
+ message += Rainbow("Reading (#{random_kanji['important_reading']}): ").bright + random_kanji[random_kanji['important_reading']]
30
+ end
31
+
32
+ def random_word
33
+ random_word = Wanikani::Level.vocabulary(random_level).sample
34
+ message = Rainbow("Your random word is ").bright + Rainbow(random_word['character']).bright.underline + "\n"
35
+ message += Rainbow("Level: ").bright + random_word['level'].to_s + "\n"
36
+ message += Rainbow("Meaning: ").bright + random_word['meaning'] + "\n"
37
+ message += Rainbow("Reading: ").bright + random_word['kana']
38
+ end
39
+
24
40
  private
25
41
 
26
42
  def queue_message(lessons, reviews, next_review_date)
@@ -42,5 +58,10 @@ module WKCheck
42
58
  message += Rainbow("#{percent}%").bright.cyan
43
59
  message += ")\n"
44
60
  end
61
+
62
+ def random_level
63
+ # Doing it this way because the `rand` function in Ruby 1.9.2 does not support ranges
64
+ (1..50).to_a.sample
65
+ end
45
66
  end
46
67
  end
@@ -1,3 +1,3 @@
1
1
  module WKCheck
2
- VERSION = '0.0.9'
2
+ VERSION = '0.0.10'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wkcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dennis Martinez