Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fixed some typos in cli.rb #7

Closed
wants to merge 2 commits into from

2 participants

@andywenk

soem typos fixed

@YorickPeterse

Looking good, I'll merge this after I'm done rewriting the AST (and everything related) in the "refactor-ast" branch.

@andywenk andywenk Change the order of the options list so that it is the same, as
mentioning them in help. Furthermore added some examples how
to use more than one analyzer.
ac9b083
@YorickPeterse

Use heredocs for this:

opts.separator <<-EOF

Examples:

    $ ruby-lint some_ruby_file.rb -a undefined_variables
    $ ruby-lint some_ruby_file.rb -a undefined_variables,method_validation

EOF

Another thing that's worth noting: I'm not a fan of big fat --help messages, keep the indentation to a minimum. If there was a decent (out of the box) way of supporting manpages in Gems I'd use that but sadly that's not really possible (without extra gems and/or hacks).

The idea with heredocs is way better!

Concerning the big fat help messages. I don't think it's big. The decision how big the help message should be has to be made out of the fact which persons are in the target group. If you intend to write this tool mostly for developers, it can be short. If you want to give the tool to a wider group of people it should be as short as possible but as long as needed to explain the point for these people.

So what's your idea here about the length of the help messages?

To be honest I'm not entirely sure. Help messages can be tremendously useful
but they can also clog up the terminal screens. In this above case I think it
would be fine to just list the commands to execute without the description,
they are fairly easy to grok just by looking at them.

ok - I am fine with that ... I'll do it this way ...

@YorickPeterse

Just a small heads up: I haven't forgotten about this pull request. I'm
currently in the middle of re-factoring most of the codebase and this has taken
up most of my time so far. Hopefully I'll be able to merge this pull request in
the coming month (giving a clear estimate is a bit difficult at this time).

@andywenk

don't you worry ;-)

@YorickPeterse

In Git commit 79a06b7 I started working on a new Slop based CLI. This means that I won't be able to merge this pull request as is. Having said that, your suggestions will be taken into account and I'll make sure to properly mention you. I'll leave this pull request (and the other issue) open until they have been addressed in the new CLI.

@YorickPeterse YorickPeterse closed this pull request from a commit
@YorickPeterse Customize the CLI using human friendly options.
This fixes #7 and fixes #8.

Signed-off-by: Yorick Peterse <yorickpeterse@gmail.com>
237a3cc
@andywenk

everything is fine with me ;-) don't worry !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 18, 2012
  1. @andywenk

    fix some typos in cli.rb

    andywenk authored
Commits on Nov 19, 2012
  1. @andywenk

    Change the order of the options list so that it is the same, as

    andywenk authored
    mentioning them in help. Furthermore added some examples how
    to use more than one analyzer.
This page is out of date. Refresh to see the latest.
Showing with 34 additions and 21 deletions.
  1. +34 −21 lib/ruby-lint/cli.rb
View
55 lib/ruby-lint/cli.rb 100644 → 100755
@@ -20,7 +20,7 @@ def initialize
opts.separator ''
opts.separator 'Usage:'
- opts.separator ' $ ruby-ling [FILES] [OPTIONS]'
+ opts.separator ' $ ruby-lint [FILES] [OPTIONS]'
opts.separator ''
opts.separator 'Analyzers:'
@@ -31,13 +31,32 @@ def initialize
opts.separator hash_to_list(@formatters)
opts.separator ''
- opts.separator 'Reporting Levels:'
+ opts.separator 'Reporting levels:'
opts.separator " error\n warning\n info"
opts.separator ''
opts.separator 'Options:'
opts.on(
+ '-a',
+ '--analyzers=VALUE',
+ 'The analyzers to enable. Comma separated if more than one.',
+ Array
+ ) do |names|
+ analyzers = Options::REQUIRED_ANALYZERS.dup
+
+ names.each do |name|
+ const = @analyzers[name]
+
+ if const and !analyzers.include?(const)
+ analyzers << const
+ end
+ end
+
+ RubyLint.options.analyzers = analyzers
+ end
+
+ opts.on(
'-f',
'--formatter=VALUE',
'The formatter to use',
@@ -57,25 +76,6 @@ def initialize
RubyLint.options.levels = levels.map { |level| level.to_sym }
end
- opts.on(
- '-a',
- '--analyzers=VALUE',
- 'The analyzers to enable',
- Array
- ) do |names|
- analyzers = Options::REQUIRED_ANALYZERS.dup
-
- names.each do |name|
- const = @analyzers[name]
-
- if const and !analyzers.include?(const)
- analyzers << const
- end
- end
-
- RubyLint.options.analyzers = analyzers
- end
-
opts.on('-h', '--help', 'Shows this help message') do
puts @option_parser
exit
@@ -84,6 +84,19 @@ def initialize
opts.on('-v', '--version', 'Shows the current version') do
version
end
+
+ opts.separator ''
+ opts.separator 'Examples:'
+ opts.separator ''
+ opts.separator ' Using one analyzer:'
+ opts.separator ' $ ruby-lint some_ruby_file.rb -a undefined_variables'
+ opts.separator ''
+ opts.separator ' Using many analyzers:'
+ opts.separator ' $ ruby-lint some_ruby_file.rb -a undefined_variables,method_validation'
+ opts.separator ''
+ opts.separator ' Using many analyzers and the reportin level warning:'
+ opts.separator ' $ ruby-lint some_ruby_file.rb -a undefined_variables,method_validation -l warning'
+ opts.separator ''
end
end
Something went wrong with that request. Please try again.