Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
* add link to documentation
* fix the example
  • Loading branch information
erdnaxeli committed Apr 11, 2021
1 parent 039431c commit 620cf45
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ It does not print anything.
It can read from ARGV but also from any array of strings.
You choose what you want to do.

**Documentation**: <https://erdnaxeli.github.io/clip/>

## Installation

1. Add the dependency to your `shard.yml`:
Expand All @@ -25,7 +27,7 @@ You choose what you want to do.

In a file command.cr:
```crystal
require "./src/clip"
require "clip"
@[Clip::Doc("An example commmand.")]
struct Command
Expand All @@ -45,8 +47,9 @@ rescue ex : Clip::ParsingError
exit
end
if command.is_a?(Command::Help)
puts Command.help
case command
when Clip::Mapper::Help
puts command.help
else
if command.effect
puts "Doing something with an effect on #{command.file}."
Expand All @@ -58,8 +61,8 @@ end

Then:
```Shell
$ crystal build command.cr
$ ./command
$ crystal build command.cr
$ ./command
Error:
argument is required: FILE
$ ./command --help
Expand All @@ -72,6 +75,7 @@ Arguments:
Options:
--effect / --no-effect Enable some effect. [default: false]
--help Show this message and exit.
$ ./command myfile
Doing something on myfile.
$ ./command --effect myfile
Expand Down

0 comments on commit 620cf45

Please sign in to comment.