dcm 0.1.27 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5cb902865c8f528d8d32808549e51ff0e08f0f910ebbc20a7b4fe86b88f757b6
4
- data.tar.gz: 825479e3f3df7d15020313b8a4dc1f2f103d9a84ae389e1307f223c05244610e
3
+ metadata.gz: fc0e0ea812e0dc047d1be88c11c3ff2e754cfbc282287448c9b80ce7020cbe92
4
+ data.tar.gz: 7ecc23e30e29ff2c5900c6e74ea239aa1559e1d82fc31bca8d29b883ae23b320
5
5
  SHA512:
6
- metadata.gz: 25334697c4789de67dfd522acf054a853614802312849c89711734f7ffdd445b284f010ce720e543500794fe8164d426ef72dcc0ac854d7a93601ad2f57cc6ef
7
- data.tar.gz: 01c20d7e8afafb326a5064bfe45f49b8b095c02372e348ab25f399aa1a1378f1f284b934368c145c2fd1ce7e15f3f16d64f24f46e57dd1e3c1b8945ce797a942
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
- puts list.to_dcm(options[:indented])
156
+ print_cached list.to_dcm(options[:indented])
143
157
  end
144
158
  end
145
159
 
@@ -147,7 +161,7 @@ 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
- puts FuzzySelector.new(list, "dcm cat -f {} #{file} | dcm show")
164
+ print_cached FuzzySelector.new(list, "dcm cat -f {} #{file} | dcm show")
151
165
  .then { _1.select_by(&:name) }
152
166
  .tap { exit if _1.empty? }
153
167
  .then { _1.to_dcm(options[:indented]) }
@@ -325,6 +339,11 @@ module Dcm
325
339
  end
326
340
  end
327
341
 
342
+ def print_cached(str)
343
+ File.write(LASTOUTPUTCACHE, str)
344
+ puts str
345
+ end
346
+
328
347
  def render_comparison(file1, file2, precision:)
329
348
  lists = [file1, file2]
330
349
  .map { FileReader.read(_1) }
@@ -9,4 +9,3 @@ class TempfileHandler
9
9
  file.close
10
10
  end
11
11
  end
12
-
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dcm
2
- VERSION = "0.1.27"
2
+ VERSION = "0.1.28"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dcm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.27
4
+ version: 0.1.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Mueller