cr.rb 3.18.0 → 3.19.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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/cr +26 -13
  3. data/lib/cr.rb +13 -0
  4. metadata +7 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e488cf547d684aa64b4ea77581d1dd0fa9bc2203d1d247983ca1758ee23a35fd
4
- data.tar.gz: 3d2cb486fc34987e637c40d14ca1a4316ad4a9f8bb2ece1d7443738c036448b5
3
+ metadata.gz: dabeb694d7888667b8f6ad18823d22eb7e1bd158e62a9269de719cdf93a067ca
4
+ data.tar.gz: e212e83a3f48df3937ed3d225e3792a72218cbbddd9b758d147b65d4e97a7153
5
5
  SHA512:
6
- metadata.gz: 9a6c17680a3ff5089c254c854571d6a093e2ccec1af6486a63d79b5d09fd354a1efa111d62749a31ae9a1031c92e2b83daa09cd2d0ca69830efca61f1f6526a8
7
- data.tar.gz: 203e97fa322cf3b7568d547ba513c99e55819ae3541ad7df4adac68c53ca33dcf4704955ae3eb5c5bbbc1ebd4152ebe2cee82737b8458612f716acd6eb6261f7
6
+ metadata.gz: fd749eb80cab8a8b6cd59747e01808e76e2a8703de6ce4b2994703cee2e0869ed1ff272457294bb68efd238755fc45f0570745fd05ccc4abe0885f0c64030e17
7
+ data.tar.gz: ac1f296da503c11a13ea7b9e49d7a2ba31df967151da0558e5eb4aa4e48864737919ac6cc796797ee02872467da31b991192d6a55136c3c472d485a58be38c37
data/bin/cr CHANGED
@@ -4,7 +4,7 @@
4
4
  # File : cr.rb
5
5
  # Authors : ccmywish <ccmywish@qq.com>
6
6
  # Created on : <2021-07-08>
7
- # Last modified : <2022-04-11>
7
+ # Last modified : <2022-04-15>
8
8
  #
9
9
  # cr:
10
10
  #
@@ -14,6 +14,7 @@
14
14
  #
15
15
  # ------------------------------------------------------
16
16
 
17
+ require 'cr'
17
18
  require 'tomlrb'
18
19
  require 'fileutils'
19
20
 
@@ -26,8 +27,6 @@ CRYPTIC_DEFAULT_DICTS = {
26
27
  medicine: "https://github.com/cryptic-resolver/cryptic_medicine.git"
27
28
  }
28
29
 
29
- CR_GEM_VERSION = "3.18.0"
30
-
31
30
 
32
31
  ####################
33
32
  # helper: for color
@@ -156,6 +155,14 @@ def add_dict(repo)
156
155
  exit -1
157
156
  end
158
157
 
158
+ # Ensure the cr home dir exists
159
+ FileUtils.mkdir_p(CRYPTIC_RESOLVER_HOME)
160
+
161
+ # Simplify adding dictionary
162
+ if !repo.start_with?("https://") and !repo.start_with?("git@")
163
+ repo = "https://github.com/#{repo}.git"
164
+ end
165
+
159
166
  begin
160
167
  puts "cr: Adding new dictionary..."
161
168
  `git -C #{CRYPTIC_RESOLVER_HOME} clone #{repo} -q`
@@ -235,7 +242,11 @@ def pp_info(info)
235
242
 
236
243
  if see_also = info['see']
237
244
  print "\n", purple("SEE ALSO ")
238
- see_also.each {|x| print underline(x),' '}
245
+ if see_also.is_a?(Array)
246
+ see_also.each {|x| print underline(x),' '}
247
+ else
248
+ print underline(see_also),' '
249
+ end
239
250
  puts
240
251
  end
241
252
  puts
@@ -580,15 +591,17 @@ def help
580
591
  cr: Cryptic Resolver v#{CR_GEM_VERSION} (#{$WordCount} words: default/#{$DefaultWordCount} user/#{user_words})
581
592
 
582
593
  usage:
583
- cr -v => Print version
584
- cr -h => Print this help
585
- cr -c => Print word count
586
- cr -l => List local dictionaries
587
- cr -u => Update all dictionaries
588
- cr -a xx.com/repo.git => Add a new dictionary
589
- cr -d cryptic_xx => Delete a dictionary
590
- cr -s pattern => Search words matched with pattern
591
- cr emacs => Edit macros: a feature-rich editor
594
+
595
+ cr emacs => Edit macros: a feature-rich editor
596
+ cr -c => Print word count
597
+ cr -l => List local dictionaries
598
+ cr -u => Update all dictionaries
599
+ cr -a repo.git => Add a new dictionary
600
+ cr -a user/repo => Add a new dictionary on Github
601
+ cr -d cryptic_xx => Delete a dictionary
602
+ cr -s pattern => Search words matched with pattern
603
+ cr -v => Print version
604
+ cr -h => Print this help
592
605
 
593
606
  HELP
594
607
 
data/lib/cr.rb ADDED
@@ -0,0 +1,13 @@
1
+ # ------------------------------------------------------
2
+ # File : cr.rb
3
+ # Authors : ccmywish <ccmywish@qq.com>
4
+ # Created on : <2022-04-15>
5
+ # Last modified : <2022-04-15>
6
+ #
7
+ # cr:
8
+ #
9
+ # This file is just a lib
10
+ #
11
+ # ------------------------------------------------------
12
+
13
+ CR_GEM_VERSION = "3.19.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cr.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.18.0
4
+ version: 3.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ccmywish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-11 00:00:00.000000000 Z
11
+ date: 2022-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tomlrb
@@ -48,12 +48,13 @@ extensions: []
48
48
  extra_rdoc_files: []
49
49
  files:
50
50
  - bin/cr
51
- homepage: https://github.com/cryptic-resolver/cr
51
+ - lib/cr.rb
52
+ homepage: https://github.com/cryptic-resolver/cr.rb
52
53
  licenses:
53
54
  - MIT
54
55
  metadata:
55
- bug_tracker_uri: https://github.com/cryptic-resolver/cr/issues
56
- source_code_uri: https://github.com/cryptic-resolver/cr
56
+ bug_tracker_uri: https://github.com/cryptic-resolver/cr.rb/issues
57
+ source_code_uri: https://github.com/cryptic-resolver/cr.rb
57
58
  post_install_message:
58
59
  rdoc_options: []
59
60
  require_paths:
@@ -69,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
70
  - !ruby/object:Gem::Version
70
71
  version: '0'
71
72
  requirements: []
72
- rubygems_version: 3.3.7
73
+ rubygems_version: 3.3.11
73
74
  signing_key:
74
75
  specification_version: 4
75
76
  summary: 'cr: Cryptic Resolver'