claide 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.markdown +6 -2
  2. data/lib/claide.rb +22 -8
  3. metadata +2 -2
@@ -4,6 +4,8 @@ I was born out of a need for a _simple_ option and command parser, while still
4
4
  providing an API that allows you to quickly create a full featured command-line
5
5
  interface.
6
6
 
7
+ [![Build Status][travis-status]][travis]
8
+
7
9
 
8
10
  ## Install
9
11
 
@@ -108,6 +110,8 @@ should not be a need to validate the parameters.
108
110
  See the [example][example] for a illustration of how to define commands.
109
111
 
110
112
 
111
- [docs]: http://rubydoc.info/github/CocoaPods/CLAide/0.1.0/frames
112
- [example]: https://github.com/alloy/CLAide/blob/master/examples/make.rb
113
+ [travis]: https://secure.travis-ci.org/CocoaPods/CLAide
114
+ [travis-status]: https://secure.travis-ci.org/CocoaPods/CLAide.png
115
+ [docs]: http://rubydoc.info/github/CocoaPods/CLAide/0.2.0/frames
116
+ [example]: https://github.com/CocoaPods/CLAide/blob/master/examples/make.rb
113
117
  [report-error]: https://github.com/CocoaPods/CocoaPods/blob/054fe5c861d932219ec40a91c0439a7cfc3a420c/lib/cocoapods/command.rb#L36
@@ -8,7 +8,7 @@ module CLAide
8
8
  #
9
9
  # CLAide’s version, following [semver](http://semver.org).
10
10
  #
11
- VERSION = '0.1.1'
11
+ VERSION = '0.2.0'
12
12
 
13
13
  # This class is responsible for parsing the parameters specified by the user,
14
14
  # accessing individual parameters, and keep state by removing handled
@@ -25,6 +25,14 @@ module CLAide
25
25
  @entries = self.class.parse(argv)
26
26
  end
27
27
 
28
+ # @return [Boolean]
29
+ #
30
+ # Returns wether or not there are any remaining unhandled parameters.
31
+ #
32
+ def empty?
33
+ @entries.empty?
34
+ end
35
+
28
36
  # @return [Array<String>]
29
37
  #
30
38
  # A list of the remaining unhandled parameters, in the same format a user
@@ -586,18 +594,25 @@ module CLAide
586
594
  attr_accessor :colorize_output
587
595
  alias_method :colorize_output?, :colorize_output
588
596
 
589
- # Sets the `verbose` attribute based on wether or not the `--verbose`
590
- # option is specified.
591
- #
592
597
  # Subclasses should override this method to remove the arguments/options
593
- # they support from argv _before_ calling `super`.
598
+ # they support from `argv` _before_ calling `super`.
599
+ #
600
+ # The `super` implementation sets the {#verbose} attribute based on wether
601
+ # or not the `--verbose` option is specified; and the {#colorize_output}
602
+ # attribute to `false` if {Command.colorize_output} returns `true`, but the
603
+ # user specified the `--no-color` option.
604
+ #
605
+ # @param [ARGV] argv
606
+ #
607
+ # A list of (user-supplied) params that should be handled.
608
+ #
594
609
  def initialize(argv)
595
610
  @verbose = argv.flag?('verbose')
596
611
  @colorize_output = argv.flag?('color', Command.colorize_output?)
597
612
  @argv = argv
598
613
  end
599
614
 
600
- # Raises a Help exception if the `--help` option is specified, if argv
615
+ # Raises a Help exception if the `--help` option is specified, if `argv`
601
616
  # still contains remaining arguments/options by the time it reaches this
602
617
  # implementation, or when called on an ‘abstract command’.
603
618
  #
@@ -611,8 +626,7 @@ module CLAide
611
626
  #
612
627
  def validate!
613
628
  help! if @argv.flag?('help')
614
- remainder = @argv.remainder
615
- help! "Unknown arguments: #{remainder.join(' ')}" unless remainder.empty?
629
+ help! "Unknown arguments: #{@argv.remainder.join(' ')}" if !@argv.empty?
616
630
  help! if self.class.abstract_command?
617
631
  end
618
632
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: claide
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-27 00:00:00.000000000 Z
13
+ date: 2012-10-30 00:00:00.000000000 Z
14
14
  dependencies: []
15
15
  description:
16
16
  email: