squared 0.4.40 → 0.4.41
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/CHANGELOG.md +18 -0
- data/lib/squared/common/base.rb +1 -0
- data/lib/squared/common/prompt.rb +1 -1
- data/lib/squared/common/utils.rb +1 -1
- data/lib/squared/version.rb +1 -1
- data/lib/squared/workspace/project/base.rb +6 -3
- data/lib/squared/workspace/project/docker.rb +26 -11
- data/lib/squared/workspace/project/git.rb +4 -4
- data/lib/squared/workspace/project/python.rb +2 -2
- data/lib/squared/workspace/project/support/class.rb +27 -5
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0137c48f9621363ac233e21140260861850c84e7b443c9f57b9b1b4b08a2a975
|
|
4
|
+
data.tar.gz: 85b0d24ef514398a93dd28fe6ba08620647023344eed66eb1aef0540610f9afc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1a6e89292a3c9e1c1cc1536750aa499f4d7c09981d5ffefa8da42879071d9861d23c03e761acd3762e08045827020050e302e07ecfd419fb9180173eae1597a7
|
|
7
|
+
data.tar.gz: e41b4bbbb2b42091ebe9429e0cf4f413b44bbf25da37bc07a2afdb06b96c59f52d1670605dece335b485b2d9bfdc7f2097bebdc22824489ae1f136e516b42975
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.41] - 2026-09-04
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Common base argument SUCCESS for command confirmation was created.
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Program options prefer using quotes instead of escape.
|
|
12
|
+
- Docker container run arguments with a leading dash are concatenated.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- Common prompt method choice did not grep list items.
|
|
17
|
+
- OptionPartition static method strip did not parse flags with dashes.
|
|
18
|
+
- Project base method choice_index did not support multiple selections.
|
|
19
|
+
|
|
3
20
|
## [0.4.40] - 2026-08-06
|
|
4
21
|
|
|
5
22
|
### Changed
|
|
@@ -1246,6 +1263,7 @@
|
|
|
1246
1263
|
|
|
1247
1264
|
- Changelog was created.
|
|
1248
1265
|
|
|
1266
|
+
[0.4.41]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.41
|
|
1249
1267
|
[0.4.40]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.40
|
|
1250
1268
|
[0.4.39]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.39
|
|
1251
1269
|
[0.4.38]: https://github.com/anpham6/squared-ruby/releases/tag/v0.4.38
|
data/lib/squared/common/base.rb
CHANGED
|
@@ -40,7 +40,7 @@ module Squared
|
|
|
40
40
|
grep &&= Array(grep).map { |val| Regexp.new(val) }
|
|
41
41
|
items = []
|
|
42
42
|
list.each do |val|
|
|
43
|
-
next if grep&.none? { |pat| pat.match?(
|
|
43
|
+
next if grep&.none? { |pat| pat.match?(val) }
|
|
44
44
|
|
|
45
45
|
items << val.to_s.chomp
|
|
46
46
|
puts "#{items.size.to_s.rjust(2)}. #{val}"
|
data/lib/squared/common/utils.rb
CHANGED
data/lib/squared/version.rb
CHANGED
|
@@ -1300,7 +1300,7 @@ module Squared
|
|
|
1300
1300
|
end
|
|
1301
1301
|
|
|
1302
1302
|
def print_success(*)
|
|
1303
|
-
puts
|
|
1303
|
+
puts ARG[:SUCCESS]
|
|
1304
1304
|
end
|
|
1305
1305
|
|
|
1306
1306
|
def print_error(*args, loglevel: Logger::WARN, **kwargs)
|
|
@@ -1681,7 +1681,10 @@ module Squared
|
|
|
1681
1681
|
if accept
|
|
1682
1682
|
hint = Array(ret).map { |val| sub_style(val, styles: theme[:inline]) }.join(', ')
|
|
1683
1683
|
accept = Array(accept).map { |val| Array(val) }
|
|
1684
|
-
|
|
1684
|
+
if accept.any? { |val| val[1] == true }
|
|
1685
|
+
ret = [ret]
|
|
1686
|
+
multiple = -1
|
|
1687
|
+
end
|
|
1685
1688
|
loop do
|
|
1686
1689
|
item = accept.first
|
|
1687
1690
|
d, e = item[2] ? ['Y', '[Y/n]'] : ['N', '[y/N]']
|
|
@@ -1698,7 +1701,7 @@ module Squared
|
|
|
1698
1701
|
exit 1 unless accept.empty?
|
|
1699
1702
|
end
|
|
1700
1703
|
if values
|
|
1701
|
-
ret =
|
|
1704
|
+
ret = [ret] unless accept && multiple == -1
|
|
1702
1705
|
Array(values).each do |val|
|
|
1703
1706
|
if val.is_a?(Array)
|
|
1704
1707
|
val, force = val
|
|
@@ -21,13 +21,13 @@ module Squared
|
|
|
21
21
|
}.freeze,
|
|
22
22
|
compose: {
|
|
23
23
|
common: %w[all-resources compatibility dry-run ansi=b env-file=p f|file=p parallel=n profile=b progress=b
|
|
24
|
-
project-directory=p p|project-name=
|
|
24
|
+
project-directory=p p|project-name=b].freeze,
|
|
25
25
|
build: %w[check no-cache print pull push with-dependencies q|quiet build-arg=qq builder=b m|memory=b
|
|
26
26
|
provenance=q sbom=q ssh=qq].freeze,
|
|
27
|
-
exec: %w[d|detach privileged e|env=qq index=i T|no-
|
|
27
|
+
exec: %w[d|detach privileged e|env=qq index=i T|no-tty=!? user=b w|workdir=q].freeze,
|
|
28
28
|
run: %w[build d|detach no-deps q|quiet quiet-build quiet-pull remove-orphans rm P|service-ports use-aliases
|
|
29
29
|
cap-add=b cap-drop=b entrypoint=q e|env=qq env-from-file=p i|interactive=b? l|label=q name=b
|
|
30
|
-
T|no-
|
|
30
|
+
T|no-tty=!? p|publish=q pull=b u|user=b v|volume=qq w|workdir=q].freeze,
|
|
31
31
|
up: %w[abort-on-container-exit abort-on-container-failure always-recreate-deps attach-dependencies build
|
|
32
32
|
d|detach force-recreate menu no-build no-color no-deps no-log-prefix no-recreate no-start quiet-build
|
|
33
33
|
quiet-pull remove-orphans V|renew-anon-volumes timestamps wait w|watch y|yes attach=b
|
|
@@ -36,9 +36,9 @@ module Squared
|
|
|
36
36
|
}.freeze,
|
|
37
37
|
container: {
|
|
38
38
|
create: %w[init i|interactive no-healthcheck oom-kill-disable privileged P|publish-all q|quiet read-only
|
|
39
|
-
rm t|tty use-api-socket add-host=q annotation=q a|attach=b blkio-weight=i
|
|
40
|
-
cap-add=b cap-drop=b cgroup-parent=b cgroupns=b cidfile=p device=q
|
|
41
|
-
device-read-bps=q device-read-iops=q device-write-bps=q device-write-iops=q
|
|
39
|
+
rm t|tty=!? use-api-socket add-host=q annotation=q a|attach=b blkio-weight=i
|
|
40
|
+
blkio-weight-device=i cap-add=b cap-drop=b cgroup-parent=b cgroupns=b cidfile=p device=q
|
|
41
|
+
device-cgroup-rule=q device-read-bps=q device-read-iops=q device-write-bps=q device-write-iops=q
|
|
42
42
|
disable-content-trust=b? dns=q dns-option=q dns-search=q domainname=b entrypoint=q e|env=qq
|
|
43
43
|
env-file=p expose=q gpus=q group-add=b health-cmd=q health-interval=b health-retries=i
|
|
44
44
|
health-start-interval=q health-start-period=q health-timeout=q hostname=q io-maxbandwidth=b
|
|
@@ -47,13 +47,14 @@ module Squared
|
|
|
47
47
|
memory-swap=n memory-swappiness=n mount=qq name=b network=b network-alias=b oom-score-adj=b
|
|
48
48
|
pid=b pids-limit=n platform=q p|publish=q pull=b restart=b runtime=b security-opt=q shm-size=b
|
|
49
49
|
stop-signal=b stop-timeout=i storage-opt=q sysctl=q tmpfs=q ulimit=q u|user=b userns=b uts=b
|
|
50
|
-
v|volume=
|
|
50
|
+
v|volume=qq volume-driver=b volumes-from=b w|workdir=q].freeze,
|
|
51
51
|
run: %w[d|detach detach-keys=q sig-proxy=b?].freeze,
|
|
52
52
|
update: %w[blkio-weight=i cpu-period=i cpu-quota=i cpu-rt-period=i cpu-rt-runtime=i c|cpu-shares=i cpus=f
|
|
53
53
|
cpuset-cpus=b cpuset-mems=b m|memory=b memory-reservation=b memory-swap=b pids-limit=n
|
|
54
54
|
restart=q].freeze,
|
|
55
|
-
exec: %w[d|detach i|interactive privileged t|tty detach-keys=q e|env=qq env-file=p user=
|
|
55
|
+
exec: %w[d|detach i|interactive privileged t|tty=!? detach-keys=q e|env=qq env-file=p user=b
|
|
56
56
|
w|workdir=q].freeze,
|
|
57
|
+
rm: %w[f|force l|link v|volumes].freeze,
|
|
57
58
|
commit: %w[a|author=q c|change=q m|message=q pause=b?].freeze,
|
|
58
59
|
inspect: %w[s|size f|format=q type=b].freeze,
|
|
59
60
|
start: %w[a|attach i|interactive detach-keys=q].freeze,
|
|
@@ -607,8 +608,22 @@ module Squared
|
|
|
607
608
|
when :exec
|
|
608
609
|
raise_error('no command args', hint: flag) if list.empty?
|
|
609
610
|
end
|
|
610
|
-
target << val
|
|
611
|
-
|
|
611
|
+
target << val
|
|
612
|
+
case list.first
|
|
613
|
+
when '--'
|
|
614
|
+
target.merge(list.drop(1))
|
|
615
|
+
when /\A(--|&&)(\s|\z)/
|
|
616
|
+
target.merge(list)
|
|
617
|
+
else
|
|
618
|
+
target << list.shift
|
|
619
|
+
unless list.empty?
|
|
620
|
+
if list.first.start_with?('-')
|
|
621
|
+
target.merge(list)
|
|
622
|
+
else
|
|
623
|
+
target << list.join(' && ')
|
|
624
|
+
end
|
|
625
|
+
end
|
|
626
|
+
end
|
|
612
627
|
end
|
|
613
628
|
|
|
614
629
|
def append_file(type, target: @session, index: 2)
|
|
@@ -783,7 +798,7 @@ module Squared
|
|
|
783
798
|
end
|
|
784
799
|
cmd.merge(Array(out).map! { |val| parse.call(val) })
|
|
785
800
|
cmd << args
|
|
786
|
-
print_success if success?(run(cmd)) && ctx.match?(/\A(?:network|tag|save)/)
|
|
801
|
+
print_success if success?(run(cmd, { 'NO_COLOR' => 'true' })) && ctx.match?(/\A(?:network|tag|save)/)
|
|
787
802
|
end
|
|
788
803
|
end
|
|
789
804
|
|
|
@@ -171,7 +171,7 @@ module Squared
|
|
|
171
171
|
}.freeze,
|
|
172
172
|
fetch: {
|
|
173
173
|
base: %w[multiple progress P|prune-tags refetch stdin u|update-head-ok recurse-submodules-default=b].freeze,
|
|
174
|
-
pull: %w[4 6
|
|
174
|
+
pull: %w[n t 4|ipv4 6|ipv6 a|append atomic dry-run f|force k|keep negotiate-only prefetch p|prune q|quiet
|
|
175
175
|
set-upstream unshallow update-shallow v|verbose deepen=i depth=i j|jobs=i negotiation-tip=q
|
|
176
176
|
recurse-submodules=v refmap=q o|server-option=q shallow-exclude=b shallow-since=v
|
|
177
177
|
upload-pack=q].freeze
|
|
@@ -207,7 +207,7 @@ module Squared
|
|
|
207
207
|
ita-invisible-in-index minimal name-only name-status no-color-moved-ws no-prefix no-renames numstat
|
|
208
208
|
patch-with-raw patch-with-stat patience pickaxe-all pickaxe-regex raw shortstat summary a|text
|
|
209
209
|
abbrev=i? anchored=q break-rewrites=b? color=b color-moved=b color-moved-ws=b color-words=q?
|
|
210
|
-
diff-algorithm=b diff-filter=
|
|
210
|
+
diff-algorithm=b diff-filter=q? X|dirstat=b? dirstat-by-file=b? dst-prefix=q find-copies=i?
|
|
211
211
|
find-object=b find-renames=b? ignore-matching-lines=q ignore-submodules=b? inter-hunk-context=i
|
|
212
212
|
line-prefix=q output=p output-indicator-context=q output-indicator-new=q output-indicator-old=q
|
|
213
213
|
relative=p rotate-to=p skip-to=p src-prefix=q stat=b? stat-count=i stat-width=i stat-name-width=i
|
|
@@ -262,7 +262,7 @@ module Squared
|
|
|
262
262
|
checkout: %w[overwrite-ignore guess overlay progress recurse-submodules track].freeze,
|
|
263
263
|
fetch: {
|
|
264
264
|
base: %w[auto-gc auto-maintenance write-commit-graph write-fetch-head].freeze,
|
|
265
|
-
pull: %w[all
|
|
265
|
+
pull: %w[all recurse-submodules show-forced-updates tags].freeze
|
|
266
266
|
},
|
|
267
267
|
log: {
|
|
268
268
|
base: %w[decorate mailmap merges use-mailmap].freeze,
|
|
@@ -1717,7 +1717,7 @@ module Squared
|
|
|
1717
1717
|
op.add_quote(remote) if remote
|
|
1718
1718
|
out, banner, from = source(io: true)
|
|
1719
1719
|
print_item banner
|
|
1720
|
-
ret = write_lines(out, grep: op.extras
|
|
1720
|
+
ret = write_lines(out, grep: op.extras)
|
|
1721
1721
|
list_result(ret, flag.to_s, grep: op.extras, banner: banner, from: from)
|
|
1722
1722
|
end
|
|
1723
1723
|
|
|
@@ -159,7 +159,7 @@ module Squared
|
|
|
159
159
|
log.warn "run script #{n} of #{list.size} (out of range)"
|
|
160
160
|
end
|
|
161
161
|
else
|
|
162
|
-
case (index > 1 && poetry?
|
|
162
|
+
case (index > 1 && poetry? ? 0 : index)
|
|
163
163
|
when 0
|
|
164
164
|
found |= 1
|
|
165
165
|
run(session_output('poetry', 'run', val), from: :run)
|
|
@@ -542,7 +542,7 @@ module Squared
|
|
|
542
542
|
case flag
|
|
543
543
|
when :hatch, :twine
|
|
544
544
|
if op.empty?
|
|
545
|
-
op.push(
|
|
545
|
+
op.push(dist.call.join('*'))
|
|
546
546
|
else
|
|
547
547
|
op.map! { |val| basepath(val) }
|
|
548
548
|
end
|
|
@@ -74,7 +74,25 @@ module Squared
|
|
|
74
74
|
return [] unless val
|
|
75
75
|
|
|
76
76
|
val = shell_split val if val.is_a?(String)
|
|
77
|
-
|
|
77
|
+
ret = []
|
|
78
|
+
pass = -1
|
|
79
|
+
(args = Array(val)).each_with_index do |s, i|
|
|
80
|
+
next if s.empty? || pass == i
|
|
81
|
+
|
|
82
|
+
if s == '--'
|
|
83
|
+
ret << s << args[i.succ..-1].join(' ')
|
|
84
|
+
break
|
|
85
|
+
end
|
|
86
|
+
next ret << s unless s.start_with?('-')
|
|
87
|
+
|
|
88
|
+
if !s.include?('=') && (j = args[i.succ]) && !j.start_with?('-')
|
|
89
|
+
ret << "#{s.sub(/^-{1,2}/, '')}=#{j}"
|
|
90
|
+
pass = i.succ
|
|
91
|
+
else
|
|
92
|
+
ret << s.sub(OPT_SINGLE, '\1=\2').sub(OPT_VALUE, '\1=\2').sub(OPT_NAME, '\2')
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
ret
|
|
78
96
|
end
|
|
79
97
|
|
|
80
98
|
def select(list, bare: true, no: true, single: false, double: false)
|
|
@@ -103,7 +121,11 @@ module Squared
|
|
|
103
121
|
end
|
|
104
122
|
|
|
105
123
|
def pattern?(val)
|
|
106
|
-
|
|
124
|
+
Regexp.new(val)
|
|
125
|
+
val.start_with?('\A', '^') || val.end_with?('\z', '$') ||
|
|
126
|
+
val.match?(/[.)][*+?]|\(\?[:=!><]|\\[dsw\d]|\[.+\]|\{\d+,?\d*\}/i)
|
|
127
|
+
rescue RegexpError
|
|
128
|
+
false
|
|
107
129
|
end
|
|
108
130
|
|
|
109
131
|
private
|
|
@@ -233,7 +255,7 @@ module Squared
|
|
|
233
255
|
end
|
|
234
256
|
numtype = [
|
|
235
257
|
[i, /\A\d+\z/],
|
|
236
|
-
[f, /\A\d
|
|
258
|
+
[f, /\A(\d+(\.\d*)?|\d*\.\d+)\z/],
|
|
237
259
|
[si, /\A-?\d+\z/]
|
|
238
260
|
].freeze
|
|
239
261
|
numcheck = ->(k, v) { numtype.any? { |flag, pat| flag.include?(k) && pat.match?(v) } }
|
|
@@ -258,8 +280,8 @@ module Squared
|
|
|
258
280
|
elsif q.include?(key)
|
|
259
281
|
add quote_option(key, val, double: qq.include?(key), merge: merge)
|
|
260
282
|
elsif p.include?(key)
|
|
261
|
-
if val
|
|
262
|
-
add shell_option(key, val, escape: false, merge: merge)
|
|
283
|
+
if val =~ /\A(["']).+\1\z/
|
|
284
|
+
add shell_option(key, val, double: $1 == '"', escape: false, merge: merge)
|
|
263
285
|
elsif path
|
|
264
286
|
add quote_option(key, path + val, merge: merge)
|
|
265
287
|
else
|
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.4.
|
|
4
|
+
version: 0.4.41
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- An Pham
|
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
126
|
version: '0'
|
|
127
127
|
requirements: []
|
|
128
|
-
rubygems_version: 4.0.
|
|
128
|
+
rubygems_version: 4.0.19
|
|
129
129
|
specification_version: 4
|
|
130
130
|
summary: Rake task generator for managing multi-language workspaces.
|
|
131
131
|
test_files: []
|