Skip to content

Commit

Permalink
fix readme
Browse files Browse the repository at this point in the history
  • Loading branch information
at-grandpa committed Jul 29, 2017
1 parent 29303bd commit 9ac15a2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,22 @@ see: [https://crystal-lang.org/api/0.23.0/OptionParser.html](https://crystal-lan
```crystal
string "-s ARG", desc: "Option description." # String option
run do |opts, args|
puts opts["s"] # => print your option value.
puts typeof(opts["s"]) # => (Array(String) | Bool | String | Nil)
puts typeof(opts["s"].as(String)) # => String
# puts opts["string-long-name"] # => ERROR: Missing hash key: "string-long-name"
puts opts["s"] # => print your option value.
puts typeof(opts["s"]) # => (Array(String) | Bool | String | Nil)
puts typeof(opts["s"].as(String)) # => String
# puts opts["string-long-name"] # => ERROR: Missing hash key: "string-long-name"
end
```

#### Long name only

```crystal
string "--string=ARG", desc: "Option description." # String option
string "--string-long-name=ARG", desc: "Option description." # String option
run do |opts, args|
puts opts["string"] # => print your option value.
puts typeof(opts["string"]) # => (Array(String) | Bool | String | Nil)
puts typeof(opts["string"].as(String)) # => String
# puts opts["s"] # => ERROR: Missing hash key: "s"
puts opts["string-long-name"] # => print your option value.
puts typeof(opts["string-long-name"]) # => (Array(String) | Bool | String | Nil)
puts typeof(opts["string-long-name"].as(String)) # => String
# puts opts["s"] # => ERROR: Missing hash key: "s"
end
```

Expand Down

0 comments on commit 9ac15a2

Please sign in to comment.