dcm 0.1.26 → 0.1.28
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/lib/cli.rb +22 -2
- data/lib/codinginfo.rb +3 -3
- data/lib/tempfile_handler.rb +0 -1
- data/lib/version.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: fc0e0ea812e0dc047d1be88c11c3ff2e754cfbc282287448c9b80ce7020cbe92
|
|
4
|
+
data.tar.gz: 7ecc23e30e29ff2c5900c6e74ea239aa1559e1d82fc31bca8d29b883ae23b320
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e288a2ad91a4eac937e746abd4ec00511b45d387e0a5e4096c1bd41f90471f77abe00db76753ea7e5a3c2ce27bb7f216b4757156b3393073d400554de760ffa5
|
|
7
|
+
data.tar.gz: e95171a8c6e9f6e24dc7f2c44a3b2ba5f6c283e5089f2955d99a5576bc669b418516ad2c33d1d8e163b281db567bb93dbfacc3638eaaff50bc39215874fffdb3
|
data/lib/cli.rb
CHANGED
|
@@ -4,6 +4,7 @@ require "bundler"
|
|
|
4
4
|
require "ecu"
|
|
5
5
|
require "thor"
|
|
6
6
|
require "filesize"
|
|
7
|
+
require "tmpdir"
|
|
7
8
|
require "json"
|
|
8
9
|
|
|
9
10
|
require_relative "file_reader"
|
|
@@ -25,6 +26,8 @@ module Dcm
|
|
|
25
26
|
|
|
26
27
|
class CLI < Thor
|
|
27
28
|
|
|
29
|
+
LASTOUTPUTCACHE = File.join(Dir.tmpdir, "lastoutput.dcm")
|
|
30
|
+
|
|
28
31
|
def help(*cmds)
|
|
29
32
|
super
|
|
30
33
|
puts <<~EOS if cmds.any? { _1.match?("creta") }
|
|
@@ -37,6 +40,17 @@ module Dcm
|
|
|
37
40
|
|
|
38
41
|
class_option :nocache, type: :boolean, aliases: ["-n"]
|
|
39
42
|
|
|
43
|
+
map _: :lastoutput
|
|
44
|
+
|
|
45
|
+
desc "lastoutput", "Repeat the last output"
|
|
46
|
+
def lastoutput
|
|
47
|
+
if File.exist?(LASTOUTPUTCACHE)
|
|
48
|
+
puts File.read(LASTOUTPUTCACHE)
|
|
49
|
+
else
|
|
50
|
+
fail "No output found - please run dcm cat|select first"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
|
|
40
54
|
desc "show FILE", "Show all labels in FILE"
|
|
41
55
|
option :oneline, type: :boolean, aliases: ["-l"]
|
|
42
56
|
def show(file=nil)
|
|
@@ -139,7 +153,7 @@ module Dcm
|
|
|
139
153
|
if options[:mfile]
|
|
140
154
|
puts list.to_mfile
|
|
141
155
|
else
|
|
142
|
-
|
|
156
|
+
print_cached list.to_dcm(options[:indented])
|
|
143
157
|
end
|
|
144
158
|
end
|
|
145
159
|
|
|
@@ -147,8 +161,9 @@ module Dcm
|
|
|
147
161
|
option :indented, aliases: ["-i"], type: :boolean, default: false
|
|
148
162
|
def select(file=nil)
|
|
149
163
|
list = parse_file(file)
|
|
150
|
-
|
|
164
|
+
print_cached FuzzySelector.new(list, "dcm cat -f {} #{file} | dcm show")
|
|
151
165
|
.then { _1.select_by(&:name) }
|
|
166
|
+
.tap { exit if _1.empty? }
|
|
152
167
|
.then { _1.to_dcm(options[:indented]) }
|
|
153
168
|
end
|
|
154
169
|
|
|
@@ -324,6 +339,11 @@ module Dcm
|
|
|
324
339
|
end
|
|
325
340
|
end
|
|
326
341
|
|
|
342
|
+
def print_cached(str)
|
|
343
|
+
File.write(LASTOUTPUTCACHE, str)
|
|
344
|
+
puts str
|
|
345
|
+
end
|
|
346
|
+
|
|
327
347
|
def render_comparison(file1, file2, precision:)
|
|
328
348
|
lists = [file1, file2]
|
|
329
349
|
.map { FileReader.read(_1) }
|
data/lib/codinginfo.rb
CHANGED
|
@@ -6,8 +6,8 @@ class Codinginfo
|
|
|
6
6
|
|
|
7
7
|
class Cvar
|
|
8
8
|
|
|
9
|
-
# The CVAR must have a name and _may_ have a package and value
|
|
10
|
-
#
|
|
9
|
+
# The CVAR must have a name and _may_ have a package and value.
|
|
10
|
+
# The package and value can be merged
|
|
11
11
|
|
|
12
12
|
attr_reader :name, :value, :package
|
|
13
13
|
attr_accessor :assignments
|
|
@@ -55,7 +55,7 @@ class Codinginfo
|
|
|
55
55
|
|
|
56
56
|
def cvars
|
|
57
57
|
@cvars ||= @properties
|
|
58
|
-
.select { |key, _| key.
|
|
58
|
+
.select { |key, _| key.start_with?("CVAR_") }
|
|
59
59
|
.map { Cvar.new(name: _1, value: _2.to_i) }
|
|
60
60
|
end
|
|
61
61
|
|
data/lib/tempfile_handler.rb
CHANGED
data/lib/version.rb
CHANGED