warg 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/warg.rb +11 -1
  3. metadata +19 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d96b90a94c51248029193228a27c43ef63e630b671a03f2cc5b5791878ef0456
4
- data.tar.gz: 946d2c64356f0f9033ba9bb1bac0694737ad34c8a0d92c0fd990c2f3aede0913
3
+ metadata.gz: 424f245fa2ac9ae05aff9e1f4c66e9c5a7a9b5660436e0d5d91a5653fc062d44
4
+ data.tar.gz: a8bc6efa101af3b880fb2a5e012f55e8a8b3510180fe33248df0cffa3f54c724
5
5
  SHA512:
6
- metadata.gz: eb1096029b3b316d249c813463440fae0264872b8be04e88c82dd97d3c9b8f592b0dc072bcbcc8e330fe9a44dedb8fe123d0f60f91b00c2d5afeb3ebe10b310f
7
- data.tar.gz: 44c808ba4a6d3468a4a3594b9cd10183cf6b87cfc3613caa9c373143ea57b0b97e96fe4c0c8095251d0e50e6329153402e9700c5e68e1684fe3c6298bb0b569b
6
+ metadata.gz: 97c01e3dfdf6df8786a91ba9532917bf3a9e270256eea18bf0cb33e2754fad957403ab9139072bb69ff1a0d6cfbcd082bbdf8cd017916531eb6846bd1fadb986
7
+ data.tar.gz: fd3d3247c2635dded91bfe9fb954a3d18fe55a6b789656e50b593579b069621421da7e6ddb339bb87ea9585604e27556bb4ca97dd890d6069b66e01f716882b0
data/lib/warg.rb CHANGED
@@ -742,7 +742,7 @@ module Warg
742
742
  build_uri!
743
743
  end
744
744
 
745
- def matches?(filters)
745
+ def matches?(**filters)
746
746
  filters.all? do |name, value|
747
747
  if respond_to?(name)
748
748
  send(name) == value
@@ -1349,6 +1349,7 @@ module Warg
1349
1349
 
1350
1350
  class Context < Config
1351
1351
  attr_reader :argv
1352
+ attr_reader :filters
1352
1353
  attr_reader :parser
1353
1354
  attr_reader :playlist
1354
1355
 
@@ -1356,16 +1357,24 @@ module Warg
1356
1357
  @argv = argv
1357
1358
  @playlist = playlist
1358
1359
  @parser = OptionParser.new
1360
+ @filters = {}
1359
1361
 
1360
1362
  @parser.on("-t", "--target HOSTS", Array, "hosts to use") do |hosts_data|
1361
1363
  hosts_data.each { |host_data| hosts.add(host_data) }
1362
1364
  end
1363
1365
 
1366
+ @parser.on("-f", "--filter key=value", String, "filters to apply to hosts") do |filter|
1367
+ key, value = filter.split("=", 2)
1368
+
1369
+ @filters[key] = value
1370
+ end
1371
+
1364
1372
  super()
1365
1373
  end
1366
1374
 
1367
1375
  def parse_options!
1368
1376
  @parser.parse(@argv)
1377
+ @hosts = @hosts.with(**@filters)
1369
1378
  end
1370
1379
 
1371
1380
  def copy(config)
@@ -1450,6 +1459,7 @@ module Warg
1450
1459
 
1451
1460
  def run
1452
1461
  if @command.nil?
1462
+ @context.parse_options!
1453
1463
  $stderr.puts "Could not find command from #{@argv.inspect}"
1454
1464
  exit 1
1455
1465
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: warg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduardo Gutierrez
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-17 00:00:00.000000000 Z
11
+ date: 2023-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt_pbkdf
@@ -54,112 +54,112 @@ dependencies:
54
54
  name: net-ssh
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ">="
58
58
  - !ruby/object:Gem::Version
59
59
  version: '6.0'
60
60
  type: :runtime
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - "~>"
64
+ - - ">="
65
65
  - !ruby/object:Gem::Version
66
66
  version: '6.0'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: net-scp
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - "~>"
71
+ - - ">="
72
72
  - !ruby/object:Gem::Version
73
73
  version: '3.0'
74
74
  type: :runtime
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - "~>"
78
+ - - ">="
79
79
  - !ruby/object:Gem::Version
80
80
  version: '3.0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: m
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
- - - "~>"
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  version: '1.0'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
- - - "~>"
92
+ - - ">="
93
93
  - !ruby/object:Gem::Version
94
94
  version: '1.0'
95
95
  - !ruby/object:Gem::Dependency
96
96
  name: byebug
97
97
  requirement: !ruby/object:Gem::Requirement
98
98
  requirements:
99
- - - "~>"
99
+ - - ">="
100
100
  - !ruby/object:Gem::Version
101
101
  version: '11'
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - "~>"
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '11'
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: pry
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
- - - "~>"
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0.13'
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
- - - "~>"
120
+ - - ">="
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0.13'
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: pry-remote
125
125
  requirement: !ruby/object:Gem::Requirement
126
126
  requirements:
127
- - - "~>"
127
+ - - ">="
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0.1'
130
130
  type: :development
131
131
  prerelease: false
132
132
  version_requirements: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - "~>"
134
+ - - ">="
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0.1'
137
137
  - !ruby/object:Gem::Dependency
138
138
  name: minitest
139
139
  requirement: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - "~>"
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: 5.15.0
144
144
  type: :development
145
145
  prerelease: false
146
146
  version_requirements: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - "~>"
148
+ - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: 5.15.0
151
151
  - !ruby/object:Gem::Dependency
152
152
  name: simplecov
153
153
  requirement: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - "~>"
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
157
  version: 0.21.2
158
158
  type: :development
159
159
  prerelease: false
160
160
  version_requirements: !ruby/object:Gem::Requirement
161
161
  requirements:
162
- - - "~>"
162
+ - - ">="
163
163
  - !ruby/object:Gem::Version
164
164
  version: 0.21.2
165
165
  description: Running one-off commands, templated scripts, or managing output from
@@ -193,7 +193,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
195
  requirements: []
196
- rubygems_version: 3.2.3
196
+ rubygems_version: 3.3.26
197
197
  signing_key:
198
198
  specification_version: 4
199
199
  summary: Light-weight interaction with servers