Crystal HTML
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
spec
src
.gitignore
.travis.yml
LICENSE
README.md
shard.yml

README.md

clim-tools

clim's tools.

Installation

$ git clone https://github.com/at-grandpa/clim-tools
$ cd clim-tools
$ crystal dep
$ crystal build src/tools.cr --release -o /path/to/clim
$ clim -h

  Clim command line interface tools.

  Usage:

    clim [sub-command] [options] ...

  Options:

    -h, --help                       Show this help.

  Sub Commands:

    init     Creates CLI tool skeleton.
    direct   Directly build the crystal code.

Tools

init

Creates CLI tool skeleton.

$ clim init -h

  Creates CLI tool skeleton.

  Usage:

    clim init command-name [options] ...

  Options:

    -h, --help                       Show this help.
    -e CODE, --eval=CODE             Code to insert into the run block.  [default:puts opts.help]
    -s NAME:DESC, --string=NAME:DESC Add "string" option.  [default:[]]
    -b NAME:DESC, --bool=NAME:DESC   Add "bool"   option.  [default:[]]
    -a NAME:DESC, --array=NAME:DESC  Add "array"  option.  [default:[]]

$ clim init hello -a name:'Target name.' -s greeting:'Words of greetings.' -e 'puts "#{opts.s["greeting"]},\n#{opts.a["name"].join(", ")}!"'

...

$ cd hello
$ crystal dep
$ crystal build src/hello.cr
$ ./hello -h

  Command Line Interface.

  Usage:

    hello [options] [arguments]

  Options:

    -h, --help                       Show this help.
    -g VALUE, --greeting=VALUE       Words of greetings.
    -n VALUE, --name=VALUE           Target name.  [default:[]]

direct

Directly build the crystal code.

$ clim direct -h

  Directly build the crystal code.

  Usage:

    clim direct [command-name] [options] ...

  Options:

    -h, --help                       Show this help.
    -o FILE, --output=FILE           Output filename.  [default:/tmp/crystal.out]
    -e CODE, --eval=CODE             Crystal code to evaluation.  [default:puts "Hello, world!!"]
    -r, --release                    Compile in release mode.  [default:false]
    -c, --clim                       Use clim library.  [default:false]
    -s NAME:DESC, --string=NAME:DESC Add "string" option. (with "-c")  [default:[]]
    -b NAME:DESC, --bool=NAME:DESC   Add "bool"   option. (with "-c")  [default:[]]
    -a NAME:DESC, --array=NAME:DESC  Add "array"  option. (with "-c")  [default:[]]

$ clim direct -o ./fib -e 'def fib(n); return n if n < 2; fib(n - 2) + fib(n - 1); end; puts fib(ARGV[0].to_i32)'
./fib
$ ./fib 10
55

Use clim library. -c or --clim

$ clim direct hello -a name:'Target name.' -s greeting:'Words of greetings.' -e 'puts "#{opts.s["greeting"]},\n#{opts.a["name"].join(", ")}!"' -o ./hello -c

./hello
$ ./hello -h

  Command Line Interface.

  Usage:

    hello_tmp [options] [arguments]

  Options:

    -h, --help                       Show this help.
    -g VALUE, --greeting=VALUE       Words of greetings.
    -n VALUE, --name=VALUE           Target name.  [default:[]]

Contributing

  1. Fork it ( https://github.com/at-grandpa/clim-tools/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Contributors