playwright-cli 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdd2831aab4e514900ed006127e7f86ebb2b5e0f310691b1bd5bc6e856b7d15b
4
- data.tar.gz: 04bd0ce28f45407fe654d56e872630b5e3a3ab1534ec66c315fc7c53c96315a2
3
+ metadata.gz: c829585e7169b44daf51c321a91e70822ef7f50594aead9e0d5f4286a4e8f1db
4
+ data.tar.gz: 06ac264cf2137f09b4a8922eabaebbe2c5b990a75f81a6bd2f1a7cb625a501a0
5
5
  SHA512:
6
- metadata.gz: 86947a60ab58ee3b734c8b5edc594ea71cf186e268440edc861b84104f56cb7caec63bc703f4fdbcd1d6e7dcd8fa53616f3f1f49f3943fe83da4674a494cd2ee
7
- data.tar.gz: 11366a11cd5b3d350b50f265469efdda3fb300314cdd978c9ec1e3cea43faf3b3a42f5c635db53655abe8e75680c7dc77b8b065fc7456e25ff616c870ce776eb
6
+ metadata.gz: 3e2a4e06da3077ad368d2358decf172785cd3dc37c4cb3233b7cf25919a2726aae225c4c69fb720e12b2665461c5013cbeeb710832d117026215b6f453163ded
7
+ data.tar.gz: 239c20e37e1244f9c30bd249c88017d7f20fb7fcc69a2ad6e44f1275d73f19e93cec64af39fa23473f6e8d7c2165d55eec41526969e4b4671596344503d605a6
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- playwright-cli (0.1.10)
4
+ playwright-cli (0.1.12)
5
5
  colorize (~> 0.1)
6
6
  git (~> 1.3)
7
7
  hanami-cli (~> 0.1)
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
- `$ echo $EDITOR`
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
- `$ playwright edit my-script`
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:
@@ -5,6 +5,7 @@ module Playwright
5
5
  class Command < Hanami::CLI::Command
6
6
  include CLI::Utils::Ask
7
7
  include CLI::Utils::Display
8
+ include CLI::Utils::FileManager
8
9
  include CLI::Utils::OS
9
10
  end
10
11
  end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Playwright
2
2
  class CLI < Hanami::CLI
3
- VERSION = "0.1.11"
3
+ VERSION = "0.1.12"
4
4
  end
5
5
  end
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.11
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