From 620cf45ea7d463eb2c20a5d9739051145ce551d8 Mon Sep 17 00:00:00 2001 From: Alexandre Morignot Date: Sun, 11 Apr 2021 15:26:00 +0200 Subject: [PATCH] Update README * add link to documentation * fix the example --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fd05609..5b76a91 100644 --- a/README.md +++ b/README.md @@ -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**: + ## Installation 1. Add the dependency to your `shard.yml`: @@ -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 @@ -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}." @@ -58,8 +61,8 @@ end Then: ```Shell -$ crystal build command.cr -$ ./command +$ crystal build command.cr +$ ./command Error: argument is required: FILE $ ./command --help @@ -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