squared 0.6.4 → 0.6.6

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.
@@ -251,7 +251,7 @@ module Squared
251
251
  print_error e
252
252
  end
253
253
  log[:progname] ||= @name
254
- log[:level] = val.match?(/\d/) ? log_sym(val.to_i) : val if (val = env('LOG_LEVEL', ignore: false))
254
+ env('LOG_LEVEL', ignore: false) { |val| log[:level] = val.start_with?(/\d/) ? log_sym(val.to_i) : val }
255
255
  log.delete(:file)
256
256
  @log = [file, log]
257
257
  end
@@ -259,28 +259,24 @@ module Squared
259
259
  def initialize_env(dev: nil, prod: nil, **)
260
260
  @dev = env_match('BUILD', dev, suffix: 'DEV', strict: true)
261
261
  @prod = env_match('BUILD', prod, suffix: 'PROD', strict: true)
262
- if @output[2] != false && (val = env('BUILD', suffix: 'ENV'))
263
- @output[2] = parse_json(val, hint: "BUILD_#{@envname}_ENV") || @output[2]
264
- end
262
+ env('BUILD', suffix: 'ENV') { |val| @output[2] = val if (val = parse_json(val)) } unless @output[0] == false
265
263
  unless @output[0] == false || @output[0].is_a?(Array)
266
- if (val = env('BUILD', suffix: 'OPTS'))
264
+ env('BUILD', suffix: 'OPTS') do |val|
267
265
  n = @output[0] ? 1 : 3
268
266
  @output[n] = merge_opts(@output[n], shell_split(val))
269
267
  end
270
- if (val = env(ref.to_s.upcase, suffix: 'OPTS'))
271
- @output[4] = merge_opts(@output[4], shell_split(val))
268
+ env(ref.to_s.upcase, suffix: 'OPTS') { |val| @output[4] = merge_opts(@output[4], shell_split(val)) }
269
+ end
270
+ env('BUILD', suffix: 'VERSION') { |val| self.version = val }
271
+ env('BUILD', strict: true) do |val|
272
+ if val == '0'
273
+ @output = [false]
274
+ elsif script?
275
+ script_set val
276
+ else
277
+ run_set val
272
278
  end
273
279
  end
274
- @version = val if (val = env('BUILD', suffix: 'VERSION'))
275
- return unless (val = env('BUILD', strict: true))
276
-
277
- if val == '0'
278
- @output = [false]
279
- elsif script?
280
- script_set val
281
- else
282
- run_set val
283
- end
284
280
  end
285
281
 
286
282
  def ==(other)
@@ -433,7 +429,7 @@ module Squared
433
429
  .sort { |a, b| b <=> a }
434
430
  .push('latest', 'system'),
435
431
  accept: [accept_y('Confirm?')],
436
- values: 'Options', force: true)
432
+ values: 'Options')
437
433
  OptionPartition.strip(opts)
438
434
  end
439
435
  asdf(flag, args, version: version)
@@ -702,7 +698,9 @@ module Squared
702
698
  if order
703
699
  out.map! do |val|
704
700
  name = ret.find { |proj| val.match?(/ #{Regexp.escape(proj.name)}(?:@\d|\z)/) }&.name
705
- (n = name && order[name]) ? val.subhint(n.succ) : val
701
+ next val unless (n = name && order[name])
702
+
703
+ val.subhint(n.succ)
706
704
  end
707
705
  else
708
706
  [out, ret]
@@ -743,9 +741,9 @@ module Squared
743
741
  end
744
742
  end
745
743
  env('HEADERS') do |val|
746
- if (data = parse_json(val, hint: "HEADERS_#{@envname}"))
747
- headers = headers.is_a?(Hash) ? headers.merge(data) : data
748
- end
744
+ next unless (data = parse_json(val))
745
+
746
+ headers = headers.is_a?(Hash) ? headers.merge(data) : data
749
747
  end
750
748
  if file
751
749
  ext ||= File.extname(file)[1..-1]
@@ -888,13 +886,9 @@ module Squared
888
886
  end
889
887
 
890
888
  def event(name, key, *args, override: false, **kwargs, &blk)
891
- data = @events[name.to_sym]
892
- items = if override
893
- data[key.to_sym] = []
894
- else
895
- data[key.to_sym] ||= []
896
- end
897
- items << [block_given? ? [blk] + args : args, kwargs]
889
+ args.unshift(blk) if block_given?
890
+ ev = @events[name.to_sym]
891
+ (override ? ev[key.to_sym] = [] : ev[key.to_sym] ||= []) << [args, kwargs]
898
892
  self
899
893
  end
900
894
 
@@ -919,8 +913,10 @@ module Squared
919
913
 
920
914
  def run(cmd = @session, var = nil, exception: self.exception, sync: true, banner: true, from: nil, chdir: path,
921
915
  interactive: nil, hint: nil, series: false, **)
922
- return print_error('no command session started', subject: project, hint: from, pass: true) unless cmd
923
-
916
+ unless cmd
917
+ print_error('no command session started', subject: project, hint: from, pass: true)
918
+ return
919
+ end
924
920
  cmd = cmd.target if cmd.is_a?(OptionPartition)
925
921
  if interactive && sync && (!@session || !option('y'))
926
922
  msg, y, h = case interactive
@@ -1120,14 +1116,41 @@ module Squared
1120
1116
  @log = Logger.new((@log.first if enabled?), **@log.last)
1121
1117
  end
1122
1118
 
1123
- def allref
1124
- @ref.reverse_each
1119
+ def allref(&blk)
1120
+ @ref.reverse_each(&blk)
1125
1121
  end
1126
1122
 
1127
1123
  def basepath(*args)
1128
1124
  path.join(*args)
1129
1125
  end
1130
1126
 
1127
+ def basepath!(*args, type: nil)
1128
+ ret = basepath(*args)
1129
+ return unless ret.exist?
1130
+
1131
+ if type
1132
+ (type.is_a?(String) ? type.chars : type).each do |ch|
1133
+ case ch
1134
+ when 'f'
1135
+ return nil unless ret.file?
1136
+ when 'd'
1137
+ return nil unless ret.directory?
1138
+ when 'l'
1139
+ return nil unless ret.symlink?
1140
+ when 'r'
1141
+ return nil unless ret.readable?
1142
+ when 'w'
1143
+ return nil unless ret.writable?
1144
+ when 'e'
1145
+ return nil unless ret.executable?
1146
+ else
1147
+ return nil
1148
+ end
1149
+ end
1150
+ end
1151
+ ret
1152
+ end
1153
+
1131
1154
  def rootpath(*args, ascend: nil)
1132
1155
  ret = basepath(*args)
1133
1156
  return ret unless ascend && !ret.exist?
@@ -1135,7 +1158,7 @@ module Squared
1135
1158
  path.parent.ascend.each do |dir|
1136
1159
  target = dir.join(*args)
1137
1160
  return target if target.exist?
1138
- break if (ascend && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
1161
+ break if (ascend.is_a?(String) && dir.join(ascend).exist?) || workspace.root == dir || parent&.path == dir
1139
1162
  end
1140
1163
  ret
1141
1164
  end
@@ -1162,6 +1185,15 @@ module Squared
1162
1185
  name.to_sym
1163
1186
  end
1164
1187
 
1188
+ protected
1189
+
1190
+ def script_get(*args, key: nil)
1191
+ ret = workspace.script_get(*args, group: group, ref: allref)
1192
+ return ret unless ret && key
1193
+
1194
+ ret.fetch(key, nil)
1195
+ end
1196
+
1165
1197
  private
1166
1198
 
1167
1199
  def puts(*args, **kwargs)
@@ -1216,9 +1248,8 @@ module Squared
1216
1248
  def graph_branch(target, data, tasks = nil, out = nil, sync: true, pass: [], done: [], order: nil, depth: 0,
1217
1249
  single: false, last: false, context: nil)
1218
1250
  tag = ->(proj) { "#{proj.name}#{"@#{proj.version}" if SEM_VER.match?(proj.version)}" }
1219
- script = ->(proj) { workspace.script_get(:graph, group: proj.group, ref: proj.allref)&.fetch(:graph, nil) }
1220
1251
  uniq = lambda do |name|
1221
- next [] unless (ret = data[name])
1252
+ return [] unless (ret = data[name])
1222
1253
 
1223
1254
  ret.dup.each do |proj|
1224
1255
  next if proj.name == name
@@ -1296,21 +1327,22 @@ module Squared
1296
1327
  end
1297
1328
  end
1298
1329
  else
1299
- (tasks || (subtasks = script.call(proj)) || (dev? ? %w[build copy] : %w[depend build])).each do |meth|
1300
- next if pass.include?(meth)
1330
+ (tasks || (graph = proj.script_get(:graph, key: :graph)) || (dev? ? %w[build copy] : %w[depend build]))
1331
+ .each do |meth|
1332
+ next if pass.include?(meth)
1301
1333
 
1302
- if workspace.task_defined?(cmd = task_join(name, meth))
1303
- if ENV.key?(key = "BANNER_#{name.upcase}")
1304
- key = nil
1305
- else
1306
- ENV[key] = '0'
1334
+ if workspace.task_defined?(cmd = task_join(name, meth))
1335
+ if ENV.key?(key = "BANNER_#{name.upcase}")
1336
+ key = nil
1337
+ else
1338
+ ENV[key] = '0'
1339
+ end
1340
+ run(cmd, sync: false, banner: false)
1341
+ ENV.delete(key) if key
1342
+ elsif proj.has?(meth, (workspace.baseref unless tasks || graph))
1343
+ proj.__send__(meth.to_sym, sync: sync)
1307
1344
  end
1308
- run(cmd, sync: false, banner: false)
1309
- ENV.delete(key) if key
1310
- elsif proj.has?(meth, (workspace.baseref unless tasks || subtasks))
1311
- proj.__send__(meth.to_sym, sync: sync)
1312
1345
  end
1313
- end
1314
1346
  end
1315
1347
  done << proj
1316
1348
  end
@@ -1376,12 +1408,13 @@ module Squared
1376
1408
  ignore = ['0'].freeze if ignore.nil?
1377
1409
  ENV[name] || ENV.fetch(key, '')
1378
1410
  end
1379
- if !equals.nil?
1411
+ if equals.nil?
1412
+ ret = default if ret.empty? || (ignore && Array(ignore).any? { |val| ret == val.to_s })
1413
+ return ret if ret.nil?
1414
+ else
1380
1415
  ret = Array(equals).any? { |val| ret == val.to_s }
1381
- elsif ret.empty? || (ignore && Array(ignore).any? { |val| ret == val.to_s })
1382
- ret = default
1383
1416
  end
1384
- return yield ret if block_given? && !ret.nil?
1417
+ return yield ret if block_given?
1385
1418
 
1386
1419
  ret
1387
1420
  end
@@ -1495,7 +1528,9 @@ module Squared
1495
1528
  end
1496
1529
 
1497
1530
  def print_error(*args, loglevel: Logger::WARN, **kwargs)
1498
- warn log_message(loglevel, *args, **kwargs) if warning?
1531
+ return unless warning?
1532
+
1533
+ warn log_message(loglevel, *args, **kwargs)
1499
1534
  end
1500
1535
 
1501
1536
  def print_run(cmd, banner = true, verbose: nil, **)
@@ -1658,11 +1693,13 @@ module Squared
1658
1693
  end
1659
1694
 
1660
1695
  def empty_status(msg, title, obj, always: false)
1661
- "#{msg}#{message(hint: message(title, obj.to_s)) unless !always && (!obj || obj == 0 || obj.to_s.empty?)}"
1696
+ return msg if !always && (!obj || obj == 0 || obj.to_s.empty?)
1697
+
1698
+ msg.subhint(obj.is_a?(Numeric) ? "#{obj} #{title}" : message(title, obj.to_s))
1662
1699
  end
1663
1700
 
1664
- def append_repeat(flag, opts, target: @session)
1665
- opts.each { |val| target << shell_option(flag, val) }
1701
+ def append_repeat(flag, opts, target: @session, **kwargs)
1702
+ opts.each { |val| target << shell_option(flag, val, **kwargs) }
1666
1703
  end
1667
1704
 
1668
1705
  def append_hash(data, target: @session || [], build: false)
@@ -1687,6 +1724,8 @@ module Squared
1687
1724
  target << basic_option(key, val)
1688
1725
  when FalseClass
1689
1726
  target << shell_option(key).sub(/^--(?!no-)/, '--no-')
1727
+ when Pathname
1728
+ target << shell_option(key, val, escape: false)
1690
1729
  else
1691
1730
  target << shell_option(key, (val if val.is_a?(String)))
1692
1731
  end
@@ -1739,20 +1778,18 @@ module Squared
1739
1778
  return if list.empty?
1740
1779
 
1741
1780
  kwargs[:ignore] = false if no && !kwargs.key?(:ignore)
1742
- [].tap do |ret|
1743
- list.flatten.each do |flag|
1744
- next unless (val = option(flag, target: target, **kwargs))
1781
+ ret = []
1782
+ list.flatten.each do |flag|
1783
+ next unless (val = option(flag, target: target, **kwargs))
1745
1784
 
1746
- if no && val == '0'
1747
- flag = "no-#{flag}"
1748
- val = nil
1749
- end
1750
- ret << shell_option(flag, (val if equals), escape: escape, quote: quote, force: force)
1785
+ if no && val == '0'
1786
+ flag = "no-#{flag}"
1787
+ val = nil
1751
1788
  end
1752
- next if ret.empty?
1753
-
1754
- merge_list target, ret
1789
+ ret << shell_option(flag, (val if equals), escape: escape, quote: quote, force: force)
1755
1790
  end
1791
+ merge_list target, ret unless ret.empty?
1792
+ ret
1756
1793
  end
1757
1794
 
1758
1795
  def append_nocolor(target: @session)
@@ -1959,22 +1996,27 @@ module Squared
1959
1996
  end
1960
1997
 
1961
1998
  def block_args(fallback = nil, &blk)
1962
- (ret = instance_eval(&blk)).nil? ? fallback : Array(ret)
1999
+ return fallback if (ret = instance_eval(&blk)).nil?
2000
+
2001
+ Array(ret)
1963
2002
  end
1964
2003
 
1965
2004
  def runenv
1966
2005
  nil
1967
2006
  end
1968
2007
 
1969
- def command(*args)
1970
- return args.join(' && ') unless workspace.powershell?
1971
-
1972
- "powershell.exe -Command #{shell_quote("& {#{args.join(' ; ')}}", option: false, double: true)}"
2008
+ def command(*args, verbose: true)
2009
+ out = unless verbose
2010
+ [">#{File::NULL}", '2>&1'].tap { |a| a.reverse if File::NULL == 'NUL' }.unshift('').join(' ')
2011
+ end
2012
+ if workspace.powershell?
2013
+ "#{shell_bin('powershell.exe')} -Command \"& {#{args.join(' ; ')}}\"#{out}"
2014
+ else
2015
+ args.map! { |val| "#{val}#{out}" }.join(' && ')
2016
+ end
1973
2017
  end
1974
2018
 
1975
2019
  def relativepath(*list, all: false)
1976
- return [] if list.empty?
1977
-
1978
2020
  list.flatten.map! { |val| Pathname.new(val) }.select { |val| projectpath?(val) }.map! do |val|
1979
2021
  ret = (val.absolute? ? val.relative_path_from(path) : val.cleanpath).to_s
1980
2022
  all && val.to_s.end_with?('/') ? "#{ret}/*" : ret
@@ -2082,7 +2124,11 @@ module Squared
2082
2124
  end
2083
2125
  end
2084
2126
 
2085
- def semgte?(val, other)
2127
+ def semgte?(val, other = nil)
2128
+ unless other
2129
+ other = val
2130
+ val = RUBY_VERSION
2131
+ end
2086
2132
  semcmp(val, other) != 1
2087
2133
  end
2088
2134
 
@@ -2175,13 +2221,15 @@ module Squared
2175
2221
  end
2176
2222
 
2177
2223
  def pwd_set(pass: false, exception: self.exception, dryrun: false, from: nil)
2178
- pwd = Dir.pwd
2179
- return yield if (path.to_s == pwd || pass == true) && (workspace.mri? || !workspace.windows?)
2224
+ return yield if (path.to_s == Dir.pwd || pass == true) && (workspace.mri? || !workspace.windows?)
2180
2225
 
2181
- Dir.chdir path
2182
- yield.tap { Dir.chdir pwd }
2226
+ pwd = Dir.pwd
2227
+ Dir.chdir(path)
2228
+ yield
2183
2229
  rescue StandardError => e
2184
2230
  on_error(e, from, exception: exception, dryrun: dryrun)
2231
+ ensure
2232
+ Dir.chdir(pwd) if pwd
2185
2233
  end
2186
2234
 
2187
2235
  def run_set(cmd, val = nil, opts: nil, global: false, **)
@@ -2286,7 +2334,7 @@ module Squared
2286
2334
  def asdf_set(val)
2287
2335
  @asdf = if @@asdf && val
2288
2336
  dir = @@asdf.path.join('installs', val)
2289
- [val, dir] if dir.exist? && !dir.empty?
2337
+ [val, dir] if dir.directory? && !dir.empty?
2290
2338
  end
2291
2339
  end
2292
2340
 
@@ -2310,7 +2358,7 @@ module Squared
2310
2358
  end
2311
2359
 
2312
2360
  def as_get(val, from)
2313
- (@global && @as[from][val]) || val
2361
+ (global && @as[from][val]) || val
2314
2362
  end
2315
2363
 
2316
2364
  def task_build(keys)
@@ -2449,7 +2497,7 @@ module Squared
2449
2497
  return false unless target.is_a?(Enumerable)
2450
2498
 
2451
2499
  args = args.first if args.size == 1 && args.first.is_a?(Enumerable)
2452
- args.any? { |obj| target.include?(obj) }
2500
+ args.any? { |obj,| target.include?(obj) }
2453
2501
  end
2454
2502
 
2455
2503
  def has_value!(target, *args, first: false)
@@ -2487,7 +2535,7 @@ module Squared
2487
2535
  end
2488
2536
 
2489
2537
  def scriptargs
2490
- { target: script? ? @output[1] : @output[0], script: script?, ref: ref, group: group, global: @global }
2538
+ { target: script? ? @output[1] : @output[0], script: script?, ref: ref, group: group, global: global }
2491
2539
  end
2492
2540
  end
2493
2541
 
@@ -154,33 +154,34 @@ module Squared
154
154
  task action, [:command] do |_, args|
155
155
  command = param_guard(action, 'command', args: args, key: :command)
156
156
  args = args.extras
157
- cmd = docker_output(command, case command
157
+ cmd = docker_output command, case command
158
158
  when 'image', 'container', 'network'
159
159
  'ls'
160
160
  when 'compose'
161
161
  'ps'
162
162
  else
163
163
  raise_error ArgumentError, 'unrecognized command', hint: command
164
- end)
164
+ end
165
165
  cmd << '-a' if has_value!(args, 'a', 'all') && command != 'network'
166
166
  data = VAL_DOCKER[:ls][command.to_sym]
167
- if has_value!(args, 's', 'standard')
168
- cols = data.first(data.index('CreatedAt'))
169
- else
170
- cols = []
171
- args.each do |val|
172
- if val =~ /^(\d+)$/
173
- cols << data[$1.to_i.pred]
174
- elsif val =~ /^(\d+)(-|\.{2,3})(\d+)$/
175
- j = $1.to_i.pred
176
- k = $3.to_i - ($2 == '..' ? 2 : 1)
177
- cols.concat(data[j..k]) if k > j
178
- end
179
- end
180
- if cols.empty?
181
- cols = choice_index('Select a column', data, multiple: true, force: true, attempts: 1)
182
- end
183
- end
167
+ cols = if has_value!(args, 's', 'standard')
168
+ data.first(data.index('CreatedAt'))
169
+ else
170
+ [].tap do |out|
171
+ args.each do |val|
172
+ if val =~ /^(\d+)$/
173
+ out << data[$1.to_i.pred]
174
+ elsif val =~ /^(\d+)(-|\.{2,3})(\d+)$/
175
+ j = $1.to_i.pred
176
+ k = $3.to_i - ($2 == '..' ? 2 : 1)
177
+ out.concat(data[j..k]) if k > j
178
+ end
179
+ end
180
+ next unless out.empty?
181
+
182
+ out.replace(choice_index('Select a column', data, multiple: true, attempts: 1))
183
+ end
184
+ end
184
185
  cmd << quote_option('format', "table #{cols.map! { |val| "{{.#{val}}}" }.join("\t")}")
185
186
  run(cmd, banner: false, from: :ls)
186
187
  end
@@ -200,7 +201,7 @@ module Squared
200
201
 
201
202
  case flag
202
203
  when :build
203
- format_desc action, flag, 'opts*,target*,context/:'
204
+ format_desc action, flag, 'opts*,target*,context|:'
204
205
  task flag do |_, args|
205
206
  args = args.to_a
206
207
  if args.first == ':'
@@ -221,7 +222,7 @@ module Squared
221
222
 
222
223
  case flag
223
224
  when :exec, :run
224
- format_desc action, flag, "service|:,command#{'?' unless flag == :exec}|::,args*,opts*"
225
+ format_desc action, flag, "service/:,command#{'?' unless flag == :exec}/::,args*,opts*"
225
226
  task flag, [:service] do |_, args|
226
227
  service = param_guard(action, flag, args: args, key: :service)
227
228
  compose!(flag, args.extras, service: service)
@@ -417,7 +418,7 @@ module Squared
417
418
  lines = IO.popen(cmd.temp('--services')).map(&:strip).reject(&:empty?)
418
419
  return list_empty(hint: status) if lines.empty?
419
420
 
420
- service = choice_index('Choose a service', lines, multiple: true, force: true, attempts: 1)
421
+ service = choice_index('Choose a service', lines, multiple: true, attempts: 1)
421
422
  end
422
423
  docker_session('compose', command, '--', *service)
423
424
  else
@@ -545,11 +546,12 @@ module Squared
545
546
  if opts.size == op.size
546
547
  index = 0
547
548
  name = nil
548
- opts.reverse_each do |opt|
549
- if (name = opt[/^name=["']?(.+?)["']?$/, 1])
550
- opts.delete(opt)
551
- break
552
- end
549
+ opts.reverse_each do |val|
550
+ next unless (arg = OptionPartition.parse_arg!('name', val))
551
+
552
+ name = arg[1]
553
+ opts.delete(val)
554
+ break
553
555
  end
554
556
  list_image(:run, from: from) do |val|
555
557
  container(:run, if name
@@ -711,7 +713,7 @@ module Squared
711
713
  when 2, 4
712
714
  return
713
715
  when 3
714
- return unless COMPOSEFILE.select { |val| basepath(val).exist? }.size > 1
716
+ return unless COMPOSEFILE.select { |val| basepath!(val) }.size > 1
715
717
  end
716
718
  end
717
719
  files = Array(@file).map { |val| quote_option('file', basepath(val)) }
@@ -732,21 +734,17 @@ module Squared
732
734
  end
733
735
 
734
736
  def append_tag(val, target: @session)
737
+ ver = option('version', target: target, ignore: false)
735
738
  case val
736
739
  when String
737
740
  split_escape val
738
- when Array
739
- val
740
741
  else
741
- []
742
- end.yield_self do |list|
743
- ver = option('version', target: target, ignore: false)
744
- list.each do |s|
745
- s = "#{s}:#{ver}" if ver && (!s.include?(':') || s.delete_suffix!(':latest'))
746
- target << basic_option('tag', tagname(s))
747
- end
748
- target
742
+ Array(val)
743
+ end.each do |s|
744
+ s = "#{s}:#{ver}" if ver && (!s.include?(':') || s.delete_suffix!(':latest'))
745
+ target << basic_option('tag', tagname(s))
749
746
  end
747
+ target
750
748
  end
751
749
 
752
750
  def filter_ps(flag, from = :'container:ps')
@@ -873,14 +871,12 @@ module Squared
873
871
  "--format='table {{.ID}}\t{{.Repository}}\t{{.Tag}}\t{{.CreatedSince}}\t{{.Size}}'"]
874
872
  end
875
873
  lines = `#{docker_output(cmd)}`.lines
876
- header = lines.shift
877
- if lines.empty?
878
- puts log_message('none found', subject: name, hint: "docker #{cmd.split(' ', 3)[0...2].join(' ')}")
874
+ if lines.size <= 1
875
+ puts log_message('none found', subject: name, hint: "docker #{cmd.split(' ', 3)[0, 2].join(' ')}")
879
876
  return
880
877
  end
881
- puts " # #{header}"
878
+ puts " # #{lines.shift}"
882
879
  multiple = false
883
- parse = ->(val) { val.split(/\s+/)[0] }
884
880
  ctx = flag.to_s
885
881
  case flag
886
882
  when :run, :exec
@@ -915,7 +911,7 @@ module Squared
915
911
  else
916
912
  cmd << opts << '--'
917
913
  end
918
- cmd.merge(Array(out).map! { |val| parse.call(val) })
914
+ cmd.merge(Array(out).map! { |val| val.split(/\s+/, 2).first })
919
915
  cmd << args
920
916
  success?(run(cmd), ctx.start_with?(/network|tag|save/))
921
917
  end