playwright-cli 0.1.11 → 0.1.12
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/Gemfile.lock +1 -1
- data/README.md +16 -2
- data/lib/playwright/cli/command.rb +1 -0
- data/lib/playwright/cli/commands/list/command.rb +25 -0
- data/lib/playwright/cli/commands/list.rb +18 -0
- data/lib/playwright/cli/commands.rb +2 -0
- data/lib/playwright/cli/utils/display.rb +17 -1
- data/lib/playwright/cli/utils/file_manager.rb +7 -0
- data/lib/playwright/cli/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c829585e7169b44daf51c321a91e70822ef7f50594aead9e0d5f4286a4e8f1db
|
4
|
+
data.tar.gz: 06ac264cf2137f09b4a8922eabaebbe2c5b990a75f81a6bd2f1a7cb625a501a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e2a4e06da3077ad368d2358decf172785cd3dc37c4cb3233b7cf25919a2726aae225c4c69fb720e12b2665461c5013cbeeb710832d117026215b6f453163ded
|
7
|
+
data.tar.gz: 239c20e37e1244f9c30bd249c88017d7f20fb7fcc69a2ad6e44f1275d73f19e93cec64af39fa23473f6e8d7c2165d55eec41526969e4b4671596344503d605a6
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -223,7 +223,9 @@ editor to use when opening one of your playwright scripts.
|
|
223
223
|
|
224
224
|
Use:
|
225
225
|
|
226
|
-
|
226
|
+
```shell
|
227
|
+
$ echo $EDITOR
|
228
|
+
```
|
227
229
|
|
228
230
|
To see what playwright will default to. You can update this in your ~/.bashrc
|
229
231
|
(or ~/.zshrc if you are using zsh).
|
@@ -232,10 +234,22 @@ In the future, I plan on allowing that to be a config you can set
|
|
232
234
|
|
233
235
|
To edit an app:
|
234
236
|
|
235
|
-
|
237
|
+
```shell
|
238
|
+
$ playwright edit my-script
|
239
|
+
```
|
236
240
|
|
237
241
|
`e` can be used instead of `edit`.
|
238
242
|
|
243
|
+
### List Apps
|
244
|
+
|
245
|
+
To see all Playwright apps, use:
|
246
|
+
|
247
|
+
```shell
|
248
|
+
$ playwright list
|
249
|
+
```
|
250
|
+
|
251
|
+
`l`, `-l`, `--list` can be used instead of `list`.
|
252
|
+
|
239
253
|
### Delete An App
|
240
254
|
|
241
255
|
Deleting a playwright app is simply:
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Playwright
|
2
|
+
class CLI < Hanami::CLI
|
3
|
+
module Commands
|
4
|
+
extend Hanami::CLI::Registry
|
5
|
+
|
6
|
+
class List < Hanami::CLI::Command
|
7
|
+
class Command
|
8
|
+
include Utils::Display
|
9
|
+
include Utils::Ask
|
10
|
+
include Utils::FileManager
|
11
|
+
|
12
|
+
def self.run
|
13
|
+
new.run
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
display.print "Playwright Scripts:\n"
|
18
|
+
display.print file_manager.list_scripts, indent: true
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'playwright/cli/commands/list/command'
|
2
|
+
|
3
|
+
module Playwright
|
4
|
+
class CLI < Hanami::CLI
|
5
|
+
module Commands
|
6
|
+
extend Hanami::CLI::Registry
|
7
|
+
|
8
|
+
class List < Hanami::CLI::Command
|
9
|
+
desc "Lists all available playwright commands."
|
10
|
+
|
11
|
+
def call(**)
|
12
|
+
Command.run
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -5,11 +5,13 @@ module Playwright
|
|
5
5
|
require 'playwright/cli/commands/destroy'
|
6
6
|
require 'playwright/cli/commands/edit'
|
7
7
|
require 'playwright/cli/commands/generate'
|
8
|
+
require 'playwright/cli/commands/list'
|
8
9
|
require 'playwright/cli/commands/version'
|
9
10
|
|
10
11
|
register "destroy", Destroy, aliases: ['delete', 'd']
|
11
12
|
register "edit", Edit, aliases: ['e']
|
12
13
|
register "generate", Generate, aliases: ['g', 'new']
|
14
|
+
register "list", List, aliases: ['-l', '--list', 'l']
|
13
15
|
register "version", Version, aliases: ['v', '-v', '--version']
|
14
16
|
end
|
15
17
|
end
|
@@ -30,7 +30,8 @@ module Playwright
|
|
30
30
|
exit 1
|
31
31
|
end
|
32
32
|
|
33
|
-
def print msg, method: :puts, color: DEFAULT_COLOR
|
33
|
+
def print msg, method: :puts, color: DEFAULT_COLOR, indent: false
|
34
|
+
msg = stringify msg, indent: indent
|
34
35
|
validate_print_method!(method)
|
35
36
|
msg = msg.send(color) if defined?(Colorize)
|
36
37
|
send(method, msg)
|
@@ -42,6 +43,21 @@ module Playwright
|
|
42
43
|
raise InvalidPrintMethod unless VALID_PRINT_METHODS.include? method.to_sym
|
43
44
|
end
|
44
45
|
|
46
|
+
def stringify msg, indent: false
|
47
|
+
indent = 1 if indent == true
|
48
|
+
case msg
|
49
|
+
when String
|
50
|
+
indent ? indentify(msg, count: indent) : msg
|
51
|
+
when Array
|
52
|
+
msg = msg.map { |ln| indentify(ln, count: indent) } if indent
|
53
|
+
msg.join("\n")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def indentify msg, count: 0
|
58
|
+
"#{" " * count}#{msg}"
|
59
|
+
end
|
60
|
+
|
45
61
|
end
|
46
62
|
end
|
47
63
|
end
|
@@ -54,6 +54,13 @@ module Playwright
|
|
54
54
|
"#{script_name}.rb"
|
55
55
|
end
|
56
56
|
|
57
|
+
def list_scripts
|
58
|
+
Dir.new(self.class.plays_dir).select do |file_or_dir|
|
59
|
+
Dir.exists?(self.class.plays_dir.join(file_or_dir)) &&
|
60
|
+
!['..', '.'].include?(file_or_dir)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
57
64
|
private
|
58
65
|
|
59
66
|
def self.playwright_parent_dir
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playwright-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Gregory
|
@@ -182,6 +182,8 @@ files:
|
|
182
182
|
- lib/playwright/cli/commands/edit/command.rb
|
183
183
|
- lib/playwright/cli/commands/generate.rb
|
184
184
|
- lib/playwright/cli/commands/generate/command.rb
|
185
|
+
- lib/playwright/cli/commands/list.rb
|
186
|
+
- lib/playwright/cli/commands/list/command.rb
|
185
187
|
- lib/playwright/cli/commands/version.rb
|
186
188
|
- lib/playwright/cli/configuration.rb
|
187
189
|
- lib/playwright/cli/registry.rb
|