Changes:
- Dropped support for Ruby 2.5
Fixes:
- Added support for Ruby 3.0 (#111)
Changes:
- Dropped support for Ruby 2.3 and 2.4 (#112)
Fixes:
- Fixed warnings appearing in Ruby 2.7 (9a3d810)
Fixes:
- Fixed bug which could cause options from one command appear in other commands (#101, #102)
Fixes:
- Don’t explicitly set default values for options (#99)
This release reverts a backwards-incompatible change introduced in 2.15.7.
To illustrate this, compare the behavior of the following command in recent versions of Cri:
option :f, :force, 'use force', argument: :forbidden
run do |opts, args, cmd|
puts "Options = #{opts.inspect}"
puts "Force? #{opts[:force]}"
puts "Option given? #{opts.key?(:force)}"
end
In Cri 2.15.6, the default is not set in the options hash, so the value is nil
and #key?
returns false:
% ./run
Options = {}
Force? nil
Option given? false
This behavior was inconsistent with what was documented: flag options were (and still are) documented to default to false
rather than nil
.
In Cri 2.15.7, the default value is false
, and explicitly set in the options hash (#key?
returns true
):
% ./run
Options = {:force=>false}
Force? false
Option given? true
This change made it impossible to detect options that were not explicitly specified, because the behavior of #key?
also changed.
In Cri 2.15.8, the default value is also false
(as in 2.15.7), but not explicitly set in the options hash (#key?
returns false
, as in 2.15.6):
% ./run
Options = {}
Force? false
Option given? false
This backwards-incompatible change was not intentional. To fix issue #94, a change in behavior was needed, but this change also affected other, previously-undefined behavior. The new behavior in 2.15.8 should fix the bug fixed in 2.15.7 (#94, #96), without causing the problems introduced in that version.
Fixes:
- Options with a forbidden argument now default to false, rather than nil (#94, #96)
Fixes:
- Fixed problem with help header not being shown if the summary is missing (#93)
Fixes:
- Restored compatibility with Ruby 2.3. (#91)
Fixes:
- Removed dependency on
colored
, which restores functionality to gems thatcolored
breaks (e.g.awesome_print
) (#89, #90)
Fixes:
- Made
ArgumentList#each
callable without a block, in which case it returns anEnumerator
(mimickingArray
) (#87, #88)
Fixes:
- Fixed option propagation for two levels or more (#85, #86)
Fixes:
- Made -h/--help not fail when parameters are defined for the command that -h/--help is called on (#76, #78)
Enhancements:
- Made
#option
raise an error when unrecognised parameters are passed to it (#77) [Marc-André Lafortune]
Features:
- Added support for parameter transformation (#72)
Features:
- Added
Cri::Command.load_file
Features:
- Added support for explicitly specifying zero parameters using
#no_params
(#71)
Features:
- Added support for parameter naming and validation (#70)
Features:
- Added support for transforming option values (#68)
Fixes:
- Restored Ruby 2.1 compatibility (for now)
Features:
- Added support for skipping option parsing (#62) [Tim Sharpe]
This release drops support for Ruby 2.1, which is no longer supported.
Fixes:
- Made default values be always returned, even when not explicitly specified (#57, #58)
Features:
- Allowed specifying default option value (#55)
Enhancements:
- Added support for specifying values for combined options (#56)
Features:
- Allowed passing
hard_exit: false
toCommand#run
to preventSystemExit
(#51) - Allowed specifying the default subcommand (#54)
Fixes:
- Fixed some grammatical mistakes
Features:
- Added support for hidden options (#43, #44) [Bart Mesuere]
Enhancements:
- Added option values to help output (#37, #40, #41)
- Made option descriptions wrap (#36, #45) [Bart Mesuere]
- Disable ANSI color codes when not supported (#31, #32)
- Added support for multi-valued options (#29) [Toon Willems]
- Made the default help command handle subcommands (#27)
- Added
#raw
method to argument arrays, returning all arguments including--
(#22)
- Fixed ordering of option groups on Ruby 1.8.x (#14, #15)
- Fixed ordering of commands when --verbose is passed (#16, #18)
- Allowed either short or long option to be, eh, optional (#9, #10) [Ken Coar]
- Fixed wrap-and-indent behavior (#12) [Ken Coar]
- Moved version information into
cri/version
- Added colors (#1)
- Added support for marking commands as hidden
- Made command help sort subcommands
- Allowed commands with subcommands to have a run block
- Added support for runners
- Split up local/global command options
- Added command filename to stack traces
- Sorted ambiguous command names
- Restored compatibility with Ruby 1.8.x
- Added DSL
- Added support for nested commands
- Made gem actually include code. D'oh.
- Initial release!