cr.rb 4.1.5 → 4.1.7
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/exe/cr +7 -6
- data/lib/cr/counter.rb +4 -7
- data/lib/cr/version.rb +2 -2
- data/lib/cr.rb +15 -17
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 949739f802d237a6c0a78c9e89f5a95c8a3234d191ac58e68fbc068e24e11696
|
4
|
+
data.tar.gz: 74eea272deaa47f8475104f5158798ccd88bffc55fab9de88d547f6d82271913
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c915a7b5392dc258fdbb9d404e4fd889f26e0513ffe1a7e99ba8a39010a0dc1009bd6927740944ffa70494c5fc7f47f894ac279f0db85249b8b44a42f8bfecd
|
7
|
+
data.tar.gz: 05a7af173eeaa85bcbf6525ec36f7afe27ea90720862c21e6814d8a4e6cf10d84ba11821f42ec76053dde3a1f172055e8cbd71c0ebebf9007a42f3423c3a79fe
|
data/exe/cr
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# File : cr.rb
|
4
4
|
# Authors : Aoran Zeng <ccmywish@qq.com>
|
5
5
|
# Created on : <2021-07-08>
|
6
|
-
# Last modified : <2023-05-
|
6
|
+
# Last modified : <2023-05-14>
|
7
7
|
#
|
8
8
|
# cr:
|
9
9
|
#
|
@@ -29,12 +29,13 @@ module CrypticResolver::CLI
|
|
29
29
|
|
30
30
|
case option
|
31
31
|
when '-l' then reslvr.list_dicts
|
32
|
-
when '-c' then reslvr.
|
32
|
+
when '-c' then reslvr.count_words
|
33
33
|
when '-u' then reslvr.update_dicts
|
34
|
-
when '-s' then reslvr.
|
35
|
-
when '-a' then reslvr.add_dict
|
36
|
-
when '-d' then reslvr.del_dict
|
37
|
-
else
|
34
|
+
when '-s' then reslvr.search_related_words args.shift
|
35
|
+
when '-a' then reslvr.add_dict args.shift
|
36
|
+
when '-d' then reslvr.del_dict args.shift
|
37
|
+
else reslvr.resolve_word option
|
38
|
+
end
|
38
39
|
end
|
39
40
|
|
40
41
|
|
data/lib/cr/counter.rb
CHANGED
@@ -1,21 +1,18 @@
|
|
1
1
|
# ---------------------------------------------------------------
|
2
2
|
# File : counter.rb
|
3
3
|
# Authors : Aoran Zeng <ccmywish@qq.com>
|
4
|
-
# Created on : <
|
5
|
-
# Last modified : <2023-05-
|
4
|
+
# Created on : <2022-03-06>
|
5
|
+
# Last modified : <2023-05-14>
|
6
6
|
#
|
7
7
|
# counter:
|
8
8
|
#
|
9
9
|
# Count words in dictionaries.
|
10
|
-
#
|
11
|
-
# ----------
|
12
|
-
# Changelog:
|
13
|
-
#
|
14
|
-
# <2023-05-09> Moved from lib/cr.rb
|
15
10
|
# ---------------------------------------------------------------
|
16
11
|
|
17
12
|
class CrypticResolver::Resolver::Counter
|
18
13
|
|
14
|
+
using Rainbow
|
15
|
+
|
19
16
|
attr_accessor :word_count_of_two_libs, # def_lib + extra_lib
|
20
17
|
:word_count_of_def_lib,
|
21
18
|
:word_count_of_extra_lib,
|
data/lib/cr/version.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# File : version.rb
|
3
3
|
# Authors : Aoran Zeng <ccmywish@qq.com>
|
4
4
|
# Created on : <2023-02-12>
|
5
|
-
# Last modified : <2023-
|
5
|
+
# Last modified : <2023-07-29>
|
6
6
|
#
|
7
7
|
# version:
|
8
8
|
#
|
@@ -11,6 +11,6 @@
|
|
11
11
|
|
12
12
|
module CrypticResolver
|
13
13
|
|
14
|
-
GEM_VERSION = "4.1.
|
14
|
+
GEM_VERSION = "4.1.7"
|
15
15
|
|
16
16
|
end
|
data/lib/cr.rb
CHANGED
@@ -2,22 +2,20 @@
|
|
2
2
|
# File : cr.rb
|
3
3
|
# Authors : Aoran Zeng <ccmywish@qq.com>
|
4
4
|
# Created on : <2022-04-15>
|
5
|
-
# Last modified : <2023-
|
5
|
+
# Last modified : <2023-07-29>
|
6
6
|
#
|
7
7
|
# cr:
|
8
8
|
#
|
9
9
|
# This file is the lib of `cr.rb``
|
10
10
|
# ------------------------------------------------------
|
11
11
|
|
12
|
-
require '
|
12
|
+
require 'rainbow/refinement'
|
13
13
|
require_relative 'cr/version'
|
14
14
|
|
15
|
-
class String
|
16
|
-
def underline = "\e[4m#{self}\e[0m"
|
17
|
-
end
|
18
|
-
|
19
15
|
class CrypticResolver::Resolver
|
20
16
|
|
17
|
+
using Rainbow
|
18
|
+
|
21
19
|
require_relative 'cr/counter'
|
22
20
|
|
23
21
|
# Notice that we only update the Default library, not Extra library
|
@@ -277,8 +275,6 @@ A info looks like this
|
|
277
275
|
end
|
278
276
|
|
279
277
|
|
280
|
-
|
281
|
-
#
|
282
278
|
# Lookup the given word in a sheet (a toml file) and also print.
|
283
279
|
# The core idea is that:
|
284
280
|
#
|
@@ -367,7 +363,6 @@ A info looks like this
|
|
367
363
|
end
|
368
364
|
|
369
365
|
|
370
|
-
#
|
371
366
|
# The main procedure of `cr`
|
372
367
|
#
|
373
368
|
# 1. Search the default library first
|
@@ -422,16 +417,15 @@ A info looks like this
|
|
422
417
|
end
|
423
418
|
|
424
419
|
|
425
|
-
#
|
426
420
|
# Delegate to `search_word_internal`
|
427
421
|
#
|
428
|
-
def
|
422
|
+
def search_related_words(pattern)
|
429
423
|
found_or_not1 = false
|
430
424
|
found_or_not2 = false
|
431
425
|
|
432
|
-
found_or_not1 =
|
426
|
+
found_or_not1 = search_related_words_internal(pattern, DEFAULT_LIB_PATH)
|
433
427
|
if @extra_lib_path
|
434
|
-
found_or_not2 =
|
428
|
+
found_or_not2 = search_related_words_internal(pattern, @extra_lib_path)
|
435
429
|
end
|
436
430
|
|
437
431
|
if (found_or_not1 == false) && (found_or_not2 == false)
|
@@ -439,8 +433,9 @@ A info looks like this
|
|
439
433
|
end
|
440
434
|
end
|
441
435
|
|
436
|
+
|
437
|
+
# This routine is quite like `resolve_word`
|
442
438
|
#
|
443
|
-
# This `search_word_internal` routine is quite like `resolve_word`
|
444
439
|
# Notice:
|
445
440
|
# We handle two cases
|
446
441
|
#
|
@@ -449,7 +444,7 @@ A info looks like this
|
|
449
444
|
#
|
450
445
|
# The second is what Ruby and Perl users like to do, handle it!
|
451
446
|
#
|
452
|
-
def
|
447
|
+
def search_related_words_internal(pattern, library)
|
453
448
|
|
454
449
|
if pattern.nil?
|
455
450
|
abort "cr: Need an argument!".bold.red
|
@@ -532,7 +527,7 @@ A info looks like this
|
|
532
527
|
end
|
533
528
|
|
534
529
|
|
535
|
-
def
|
530
|
+
def count_words
|
536
531
|
@counter.count!(display: true)
|
537
532
|
end
|
538
533
|
|
@@ -542,12 +537,15 @@ end
|
|
542
537
|
|
543
538
|
class CrypticResolver::Resolver
|
544
539
|
|
540
|
+
using Rainbow
|
541
|
+
|
545
542
|
require 'tomlrb'
|
546
543
|
require 'fileutils'
|
544
|
+
require 'standard_path'
|
547
545
|
|
548
546
|
# attr_accessor :default_dicts # Default dictionaries lists
|
549
547
|
|
550
|
-
DEFAULT_LIB_PATH =
|
548
|
+
DEFAULT_LIB_PATH = StandardPath.app_data 'Cryptic-Resolver'
|
551
549
|
|
552
550
|
ORIGINAL_DEFAULT_DICTS = [
|
553
551
|
"https://github.com/cryptic-resolver/cryptic_common.git",
|
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: 4.1.
|
4
|
+
version: 4.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aoran Zeng
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tomlrb
|
@@ -39,19 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rainbow
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '3.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '3.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: standard_path
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.1'
|
55
69
|
description: |
|
56
70
|
This command line tool `cr` is used to record and explain cryptic commands, acronyms(initialism), abbreviations and so forth in daily life.
|
57
71
|
Not only can it be used in computer filed via our default sheet cryptic_computer, but also you can use this to manage your own knowledge base easily.
|
@@ -89,5 +103,5 @@ requirements: []
|
|
89
103
|
rubygems_version: 3.4.8
|
90
104
|
signing_key:
|
91
105
|
specification_version: 4
|
92
|
-
summary:
|
106
|
+
summary: Resolve cryptic commands/acronyms on the command line
|
93
107
|
test_files: []
|