plz 0.0.8 → 0.0.9

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
  SHA1:
3
- metadata.gz: 74ec91c41138b2f96d02372d1166737067d0bb1a
4
- data.tar.gz: 3f8766d51ffb4bc9dd2e72bc318de6d0fd3c02b9
3
+ metadata.gz: 61c460aa6b8d8420a207412cd8eb6b4f021fa1ec
4
+ data.tar.gz: 54758d244a1c9327be1fdbf792b39fcf1e771923
5
5
  SHA512:
6
- metadata.gz: d87b4bd04dfa82276006b3e1340b6f2b34250fc4403d6b74895de0d967ea5fe9eb401422afa63b6ac1947bad3770ad1df653fd9cdb78b065828e65d7b4c81c4c
7
- data.tar.gz: 442b673abd50fafd745cd3996e4c436ebb8de0f7cb3b28711ece3d7a3f0adc97284332a7efc5c3cbf6c3fb8aa696cf3b2ac6fb46c9b68b0fba5761f23da4d477
6
+ metadata.gz: d041b2b035559bdbefeb2ca63a7c40232840e2c9ea2a4859512e5c8509fed86e45aa7af0a0b7153df8dc9ec70b6d4797a71390ce2a56b7e58f4e3855c3dd7d78
7
+ data.tar.gz: bed7866059fee8e2227e0944e235a6f405d74d931a5648f381883c9b6b0a4a89b72968d282715e26c1074ec56ae2a0a6b83aaba004c2d92fa586dd524ca9785c
@@ -1,3 +1,6 @@
1
+ ## 0.0.9
2
+ * Show example args if URI Template and example value defined
3
+
1
4
  ## 0.0.8
2
5
  * Fix bug :bug:
3
6
 
data/README.md CHANGED
@@ -54,6 +54,23 @@ while `key:=value` is parsed into JSON value (e.g. key:=17 will be `{"key":17}`)
54
54
  $ plz create user name=alice age:=17
55
55
  ```
56
56
 
57
+ ### Options
58
+ Plz takes some command line options.
59
+
60
+ ```sh
61
+ $ plz --help
62
+ Usage: plz <action> <target> [headers|params] [options]
63
+ -h, --help Display help message
64
+ --no-color Disable coloring output
65
+ --no-response-body Hide response body
66
+ --no-response-header Hide response header
67
+ Examples:
68
+ plz list user
69
+ plz create user
70
+ plz update user id=1
71
+ plz delete user id=1
72
+ ```
73
+
57
74
  ### Example
58
75
  ```sh
59
76
  # GET /users
@@ -18,11 +18,20 @@ module Plz
18
18
  # @return [Array<String>]
19
19
  def links
20
20
  @schema.properties.map do |target_name, schema|
21
- schema.links.map do |link|
22
- if link.href && link.method && link.title
23
- " plz #{link.title.underscore} #{target_name.underscore}"
21
+ schema.links.select do |link|
22
+ link.href && link.method && link.title
23
+ end.map do |link|
24
+ str = " plz #{link.title.underscore} #{target_name.underscore}"
25
+ if key = link.href[/{(.+)}/, 1]
26
+ name = key.gsub(/[()]/, "").split("/").last
27
+ if property = link.parent.properties[name]
28
+ if example = property.data["example"]
29
+ str << " #{name}=#{example.inspect}"
30
+ end
31
+ end
24
32
  end
25
- end.compact
33
+ str
34
+ end
26
35
  end.flatten
27
36
  end
28
37
  end
@@ -1,3 +1,3 @@
1
1
  module Plz
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura