cr.rb 4.0.0.alpha.1 → 4.0.0.alpha.3
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/bin/cr +36 -21
- data/lib/cr.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: 1cab1b378efd946710c171f3dc45c994c5cc76a3b6672fc25fc696aa017dbb29
|
4
|
+
data.tar.gz: b7e9b9e5d3834ac18e898e9024cf4573f15197d00cc746f50685ea30f68efc9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f75f57865bd0651a336d2ca553c5745974f892ffa5841fb4a3420efd1714ae1e08835632f77c45f5610002cae1190dc1d9e49c68a46865d576f91b114a56b134
|
7
|
+
data.tar.gz: 422bc7721e40f6878bea1f47c7781e0a8fa81e982eb9dfd1fdb9e766ea4bca753c84203c231aa96b04c0de083ca711a9c4d738ed94ee08dd79b66084e3b103e7
|
data/bin/cr
CHANGED
@@ -54,6 +54,15 @@ else
|
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
+
# Prevent runtime error
|
58
|
+
if not CR_EXTRA_LIBRARY.nil?
|
59
|
+
if ! test('d', CR_EXTRA_LIBRARY)
|
60
|
+
puts "FATAL: Your CRYPTIC_RESOLVER_CONFIG's option 'EXTRA_LIBRARY' is NOT a legal directory!"
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
|
57
66
|
# This is used to display what you are pulling when adding dicts
|
58
67
|
CR_DEFAULT_DICTS_USER_AND_NAMES = CR_DEFAULT_DICTS.map do |e|
|
59
68
|
user, repo = e.split('/').last(2)
|
@@ -313,11 +322,11 @@ end
|
|
313
322
|
# # category
|
314
323
|
#
|
315
324
|
# [blah]
|
316
|
-
# same = "XDG downloader
|
325
|
+
# same = "XDG downloader =>xdg.Download" # this is correct
|
317
326
|
#
|
318
327
|
# [blah]
|
319
328
|
# name = "BlaH" # You may want to display a better name first
|
320
|
-
# same = "XDG downloader
|
329
|
+
# same = "XDG downloader =>xdg.Download" # this is correct
|
321
330
|
#
|
322
331
|
#
|
323
332
|
def pp_same_info(library, dict, word, cache_content, same_key, own_name)
|
@@ -339,13 +348,13 @@ def pp_same_info(library, dict, word, cache_content, same_key, own_name)
|
|
339
348
|
#
|
340
349
|
# 'jump to' will output to user, so this is important not only inside our sheet.
|
341
350
|
#
|
342
|
-
# same = "XDM downloader
|
351
|
+
# same = "XDM downloader=>xdm.Download"
|
343
352
|
#
|
344
|
-
# We split 'same' key into two parts via spaceship symbol
|
353
|
+
# We split 'same' key into two parts via spaceship symbol `=>`, first part will
|
345
354
|
# output to user, the second part is for internal jump.
|
346
355
|
#
|
347
356
|
|
348
|
-
jump_to, same = same_key.split("
|
357
|
+
jump_to, same = same_key.split("=>")
|
349
358
|
same = jump_to if same.nil?
|
350
359
|
|
351
360
|
unless own_name
|
@@ -517,7 +526,7 @@ def resolve_word(word)
|
|
517
526
|
index = word.chr
|
518
527
|
case index
|
519
528
|
when '0'..'9'
|
520
|
-
index = '
|
529
|
+
index = '0-9'
|
521
530
|
end
|
522
531
|
|
523
532
|
# cache lookup's results
|
@@ -543,9 +552,12 @@ cr: Not found anything.
|
|
543
552
|
|
544
553
|
You may
|
545
554
|
1. Use `cr -u` to update all dicts
|
546
|
-
|
547
|
-
|
548
|
-
|
555
|
+
|
556
|
+
2. Use
|
557
|
+
|
558
|
+
`cr -l` to list available official dicts
|
559
|
+
|
560
|
+
`cr -a repo` to add some dicts
|
549
561
|
|
550
562
|
3. Contribute to theses dicts
|
551
563
|
|
@@ -634,11 +646,11 @@ Usage:
|
|
634
646
|
cr emacs => Edit macros: A feature-rich editor
|
635
647
|
cr -c => Print word count
|
636
648
|
cr -l => List local dicts and official dicts
|
637
|
-
cr -u => Update all dicts in
|
649
|
+
cr -u => Update all dicts in Default library
|
638
650
|
|
639
651
|
cr -a repo.git => Add a new dict
|
640
652
|
cr -a user/repo => Add a new dict from Github
|
641
|
-
cr -a
|
653
|
+
cr -a repo => Add an official dict from Github
|
642
654
|
|
643
655
|
cr -d cryptic_xx => Delete a dict
|
644
656
|
cr -s pattern => Search words matched with pattern
|
@@ -716,7 +728,6 @@ def word_count(p:)
|
|
716
728
|
is_there_any_dict?
|
717
729
|
|
718
730
|
default_lib = Dir.children(CR_DEFAULT_LIBRARY)
|
719
|
-
extra_lib = Dir.children(CR_EXTRA_LIBRARY)
|
720
731
|
|
721
732
|
# Count default library
|
722
733
|
unless default_lib.empty?
|
@@ -729,17 +740,21 @@ def word_count(p:)
|
|
729
740
|
end
|
730
741
|
end
|
731
742
|
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
extra_lib.
|
737
|
-
wc =
|
738
|
-
|
739
|
-
|
743
|
+
|
744
|
+
if CR_EXTRA_LIBRARY
|
745
|
+
extra_lib = Dir.children(CR_EXTRA_LIBRARY)
|
746
|
+
# Count extra library
|
747
|
+
unless extra_lib.empty?
|
748
|
+
wc = 0
|
749
|
+
puts(bold(blue("\nExtra library:"))) if p
|
750
|
+
extra_lib.each do |s|
|
751
|
+
wc = count_dict_words(CR_EXTRA_LIBRARY,s)
|
752
|
+
$ExtraLibWordCount += wc
|
753
|
+
puts(" #{s.ljust(17)}: #{wc}") if p
|
754
|
+
end
|
740
755
|
end
|
741
|
-
$TwoLibWordCount = $DefaultLibWordCount + $ExtraLibWordCount
|
742
756
|
end
|
757
|
+
$TwoLibWordCount = $DefaultLibWordCount + $ExtraLibWordCount
|
743
758
|
|
744
759
|
if p
|
745
760
|
puts
|
data/lib/cr.rb
CHANGED