denisdefreyne / cri

A tool for building commandline applications
MIT License
120 stars 19 forks source link

Allow specifying no_params #71

Closed denisdefreyne closed 6 years ago

denisdefreyne commented 6 years ago

This adds no_params, which explicitly defines a command as taking no arguments.

Example:

command = Cri::Command.define do
  name        'reset'
  usage       'reset'
  summary     'resets the site'
  description '…'
  no_params

  run do |opts, args, cmd|
    puts "Resetting…"
  end
end
% my-tool reset x
reset: incorrect number of arguments given: expected 0, but got 1
% my-tool reset
Resetting…
%