squared 0.5.24 → 0.5.25

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: '028d4b5e86e6d05c09f73ecab333c5332dc87e6a4fc9491965eb5ed51f34499e'
4
- data.tar.gz: 464d5a95488fafbcc13f0569ccc31d80732e5181572627ca02bd58ec040819c3
3
+ metadata.gz: e0cd4ff3d9faafb78e2d7f13560866b4db396f766f06c4dd0def6e228fbb3b28
4
+ data.tar.gz: 8e30a7002e81361a7554a232cee8483f1ecc99e4920431dc60242595ff4b8a15
5
5
  SHA512:
6
- metadata.gz: 25457fbc4821b604ccbe49e7ac6dbcdd677996ead1d39a089e8f745a7ee2d94215c065c54aa7abb9335c04cb72dc73832ca209cb8e8bda6dc9979f84dcda66c5
7
- data.tar.gz: 10e04c8c835b34ec1bb2f34e14a4f4ac25551b89ee7f1bd07cdd9d3503f87d3fff1980073ac6142a37c184d05e704a6b0d8608d50023f94511db197d2a659e83
6
+ metadata.gz: 3f7a5569c684260af71ced323cc90a4574b291e38c42cd6118811f2f1cbc7c6b6ce3880217260721de122bd742feedc986ff0f147cc248b5b16eb38c6df25f7a
7
+ data.tar.gz: a42bf79be7e6d83776e97c67cef06cdb7a5183db8b788a69fc489e2156d7d366644433ea8ad677126e7ae191d33631b242f96ed0bdf179885e9e15b0462baa70
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.25] - 2026-07-04
4
+
5
+ ### Fixed
6
+
7
+ - See `0.4.39`.
8
+
9
+ ## [0.4.39] - 2026-07-04
10
+
11
+ ### Changed
12
+
13
+ - Common global argument OUT with a file separator overrides PIPE.
14
+
15
+ ### Fixed
16
+
17
+ - Git output list results did not hide footer when banner was disabled.
18
+ - Project banners which were empty were being printed.
19
+
3
20
  ## [0.5.24] - 2026-06-14
4
21
 
5
22
  ### Fixed
@@ -1420,6 +1437,7 @@
1420
1437
 
1421
1438
  - Changelog was created.
1422
1439
 
1440
+ [0.5.25]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.25
1423
1441
  [0.5.24]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.24
1424
1442
  [0.5.23]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.23
1425
1443
  [0.5.22]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.22
@@ -1445,6 +1463,7 @@
1445
1463
  [0.5.2]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.2-ruby
1446
1464
  [0.5.1]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.1-ruby
1447
1465
  [0.5.0]: https://github.com/anpham6/squared-ruby/releases/tag/v0.5.0-ruby
1466
+ [0.4.39]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.39
1448
1467
  [0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
1449
1468
  [0.4.37]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.37
1450
1469
  [0.4.36]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.36
@@ -150,11 +150,19 @@ module Squared
150
150
  end
151
151
 
152
152
  def env_pipe(key, default = 1, suffix: nil, strict: false, root: nil)
153
+ out = 1
153
154
  case key
154
155
  when ::String
155
156
  case (ret = env_value(key, suffix: suffix, strict: strict))
156
157
  when '0', '1', '2'
157
158
  return ret.to_i
159
+ else
160
+ out = default if default.is_a?(::Numeric)
161
+ if ret.include?(File::SEPARATOR)
162
+ default = ret
163
+ elsif key.include?(File::SEPARATOR)
164
+ default = key
165
+ end
158
166
  end
159
167
  when ::Numeric
160
168
  return key if key.between?(0, 2)
@@ -165,7 +173,7 @@ module Squared
165
173
  (root ? Pathname.new(root) + default : Pathname.new(default)).realdirpath
166
174
  rescue StandardError => e
167
175
  warn e
168
- 1
176
+ out
169
177
  end
170
178
  end
171
179
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Squared
4
- VERSION = '0.5.24'
4
+ VERSION = '0.5.25'
5
5
  end
@@ -95,7 +95,13 @@ module Squared
95
95
  @kind = Support.hashlist
96
96
  @extensions = []
97
97
  @envname = env_key(@main).freeze
98
- @pipe = $DEBUG ? 2 : env_pipe(pipe, (ARG[:OUT] && env(ARG[:OUT])) || 1, root: @home)
98
+ @pipe = if $DEBUG
99
+ 2
100
+ elsif (out = ARG[:OUT]) && out.include?(File::SEPARATOR)
101
+ env_pipe(out, pipe, root: home)
102
+ else
103
+ env_pipe(pipe, (out && env(out)) || 1, root: home)
104
+ end
99
105
  @exception = env_bool exception
100
106
  @verbose = if $VERBOSE.nil?
101
107
  false
@@ -1379,7 +1379,7 @@ module Squared
1379
1379
  def print_item(*val, series: true)
1380
1380
  puts unless printfirst?
1381
1381
  printsucc if series
1382
- puts val unless val.empty? || (val.size == 1 && val.first.nil?)
1382
+ puts val unless val.empty? || (val.size == 1 && (!val.first || val.first.empty?))
1383
1383
  end
1384
1384
 
1385
1385
  def print_banner(*lines, client: false, styles: theme[:banner], border: borderstyle, **)
@@ -1815,12 +1815,16 @@ module Squared
1815
1815
 
1816
1816
  def matchmap(list, prefix = nil)
1817
1817
  list.map do |val|
1818
- if val.is_a?(Regexp)
1819
- val
1820
- else
1821
- val = ".*#{val}" if prefix && !val.sub!(/\A(\^|\\A)/, '')
1822
- Regexp.new("#{prefix}#{val == '*' ? '.+' : val}")
1818
+ next val if val.is_a?(Regexp)
1819
+
1820
+ if prefix
1821
+ a = nil
1822
+ (val = val.dup).sub!(/\A(\^|\\A)/) do |s|
1823
+ a = s
1824
+ nil
1825
+ end
1823
1826
  end
1827
+ Regexp.new("#{a}#{prefix}#{val == '*' ? '.+' : val}")
1824
1828
  end
1825
1829
  end
1826
1830
 
@@ -207,7 +207,7 @@ module Squared
207
207
  end
208
208
  end
209
209
  else
210
- format_desc action, flag, "opts*,id/name#{flag == :update ? '+' : '*'}"
210
+ format_desc action, flag, "opts*,id/name#{flag == :update || flag == :inspect ? '+' : '*'}"
211
211
  task flag do |_, args|
212
212
  container flag, args.to_a
213
213
  end
@@ -416,7 +416,7 @@ module Squared
416
416
  end
417
417
  end
418
418
  append_command(flag, id || tagmain, op.extras)
419
- when :update
419
+ when :update, :inspect
420
420
  raise_error('missing container', hint: flag) if op.empty?
421
421
  op.append(escape: true, strip: /^:/)
422
422
  when :commit
@@ -1139,7 +1139,7 @@ module Squared
1139
1139
  op.clear
1140
1140
  out, banner, from = source(io: true)
1141
1141
  print_item banner
1142
- list_result(write_lines(out), 'objects', from: from)
1142
+ list_result(write_lines(out), 'objects', banner: banner, from: from)
1143
1143
  return
1144
1144
  end
1145
1145
  else
@@ -1188,7 +1188,7 @@ module Squared
1188
1188
  end
1189
1189
  out, banner, from = source(io: true)
1190
1190
  ret = write_lines(out, banner: banner, sub: sub)
1191
- list_result(ret, 'files', from: from, action: 'modified')
1191
+ list_result(ret, 'files', action: 'modified', banner: banner, from: from)
1192
1192
  end
1193
1193
 
1194
1194
  def revbuild(flag = nil, opts = [], sync: nil, **kwargs)
@@ -1334,7 +1334,7 @@ module Squared
1334
1334
  out, banner, from = source(io: true)
1335
1335
  print_item banner
1336
1336
  ret = write_lines(out, grep: op.extras)
1337
- list_result(ret, 'tags', from: from, grep: op.extras)
1337
+ list_result(ret, 'tags', grep: op.extras, banner: banner, from: from)
1338
1338
  return
1339
1339
  end
1340
1340
  remote ||= option 'remote'
@@ -1577,7 +1577,7 @@ module Squared
1577
1577
  { pat: /^(\*\s+)(\S+)(.*)$/, styles: color(:green), index: 2 },
1578
1578
  { pat: %r{^(\s*)(remotes/\S+)(.*)$}, styles: color(:red), index: 2 }
1579
1579
  ])
1580
- list_result(ret, 'branches', from: from)
1580
+ list_result(ret, 'branches', banner: banner, from: from)
1581
1581
  return
1582
1582
  else
1583
1583
  if (head = git_spawn('rev-parse --abbrev-ref HEAD').chomp).empty?
@@ -1724,7 +1724,7 @@ module Squared
1724
1724
  out, banner, from = source(io: true)
1725
1725
  print_item banner
1726
1726
  ret = write_lines(out, grep: op.extras, prefix: "refs/#{flag}/")
1727
- list_result(ret, flag.to_s, from: from, grep: op.extras)
1727
+ list_result(ret, flag.to_s, grep: op.extras, banner: banner, from: from)
1728
1728
  end
1729
1729
 
1730
1730
  def ls_files(flag, opts = [])
@@ -1734,7 +1734,7 @@ module Squared
1734
1734
  out, banner, from = source(io: true)
1735
1735
  print_item banner
1736
1736
  ret = write_lines(out, grep: op.extras)
1737
- list_result(ret, 'files', from: from, grep: op.extras)
1737
+ list_result(ret, 'files', grep: op.extras, banner: banner, from: from)
1738
1738
  end
1739
1739
 
1740
1740
  def git(flag, opts = [])
@@ -1900,14 +1900,20 @@ module Squared
1900
1900
  ret += 1
1901
1901
  break if first
1902
1902
  end
1903
- print_item banner, out if banner && (ret > 0 || (!pass && !first))
1903
+ if banner && (ret > 0 || (!pass && !first))
1904
+ if banner.empty?
1905
+ print_item(*out)
1906
+ else
1907
+ print_item(banner, *out)
1908
+ end
1909
+ end
1904
1910
  ret
1905
1911
  end
1906
1912
 
1907
- def list_result(size, type, grep: [], action: 'found', from: nil)
1913
+ def list_result(size, type, action: 'found', grep: [], banner: nil, from: nil)
1908
1914
  if size == 0
1909
1915
  puts empty_status("No #{type} were #{action}", 'grep', grep.join(', '))
1910
- elsif stdout?
1916
+ elsif stdout? && (banner.nil? || (banner.is_a?(String) && !banner.empty?))
1911
1917
  styles = theme.fetch(:banner, []).reject { |s| s.to_s.end_with?('!') }
1912
1918
  styles << :bold if styles.size <= 1
1913
1919
  puts print_footer("#{size} #{size == 1 ? type.sub(/(?:(?<!l)e)?s\z/, '') : type}",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: squared
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.24
4
+ version: 0.5.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - An Pham