shellopts 2.4.0 → 2.4.1
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/shellopts/argument_type.rb +12 -10
- data/lib/shellopts/version.rb +1 -1
- 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: 53f85a46df1cf2280e591fbf996781c73e3ddb3dfe88ede023f6ef29f26995a4
|
4
|
+
data.tar.gz: 0ffb37c5f3843e92676004994600687dec0db89afccd20dea984998692e160a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e67de152c69ae86557ec6898e7b0402d4188b8ca57a53128cfd7b3521655e80aadbc6114bcf943101f1a4012216604703dba54ae2a6921019d228b0b343b1837
|
7
|
+
data.tar.gz: bfe12de981b2504514cd42c81f64511d01fe7948d1d8a563b2f34473d30fa8cd7e5cc22f550e9e81bd3a31ff3da863adbc60dd33ffd9fed53ea69d0bc8907a62
|
@@ -60,6 +60,17 @@ module ShellOpts
|
|
60
60
|
class FileArgument < ArgumentType
|
61
61
|
attr_reader :kind
|
62
62
|
|
63
|
+
def subject # Used in error messages
|
64
|
+
@subject ||=
|
65
|
+
case kind
|
66
|
+
when :file, :efile, :nfile, :ifile, :ofile; "file"
|
67
|
+
when :dir, :edir, :ndir; "directory"
|
68
|
+
when :path, :epath, :npath; "path"
|
69
|
+
else
|
70
|
+
raise ArgumentError
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
63
74
|
def initialize(kind)
|
64
75
|
constrain kind, :file, :dir, :path, :efile, :edir, :epath, :nfile, :ndir, :npath, :ifile, :ofile
|
65
76
|
@kind = kind
|
@@ -128,15 +139,6 @@ module ShellOpts
|
|
128
139
|
|
129
140
|
protected
|
130
141
|
def match_path(name, literal, kind, method, mode)
|
131
|
-
subject =
|
132
|
-
case kind
|
133
|
-
when :file, :efile, :nfile, :ifile, :ofile; "file"
|
134
|
-
when :dir, :edir, :ndir; "directory"
|
135
|
-
when :path, :epath, :npath; "path"
|
136
|
-
else
|
137
|
-
raise ArgumentError
|
138
|
-
end
|
139
|
-
|
140
142
|
# file exists and is the rigth type?
|
141
143
|
if File.send(method, literal)
|
142
144
|
if mode == :new
|
@@ -174,7 +176,7 @@ module ShellOpts
|
|
174
176
|
set_message "Illegal path in #{name}: #{literal}"
|
175
177
|
end
|
176
178
|
else
|
177
|
-
set_message "Can't find #{literal}"
|
179
|
+
set_message "Can't find #{subject} #{literal}"
|
178
180
|
end
|
179
181
|
end
|
180
182
|
end
|
data/lib/shellopts/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shellopts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.4.
|
4
|
+
version: 2.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Claus Rasmussen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: forward_to
|