lib/inch/cli/command/options/base.rb in inch-0.5.0.rc3 vs lib/inch/cli/command/options/base.rb in inch-0.5.0.rc4
- old
+ new
@@ -1,6 +1,6 @@
-require 'optparse'
+require "optparse"
module Inch
module CLI
module Command
# The classes in the Command::Options namespace are concerned with
@@ -35,10 +35,12 @@
end
end
end
attribute :usage, "" # usage description for the command
+ attribute :language, "ruby" # the programming language
+ attribute :read_dump_file, nil
attribute :paths, [] # the paths of the to-be-analysed sources
attribute :excluded, [] # paths to be excluded from the analysis
# Parses the given +args+ "into" the current Options object
#
@@ -89,52 +91,51 @@
# Returns a decriptive hint explaining the arrows used to represent
# code object priorities
#
# @return [String]
def description_hint_arrows
- arrows = Evaluation::PriorityRange.all.map(&:arrow).join(' ')
- "Arrows (#{arrows}) hint at the importance of the object " +
+ arrows = Evaluation::PriorityRange.all.map(&:arrow).join(" ")
+ "Arrows (#{arrows}) hint at the importance of the object " \
"being documented."
end
# Returns a decriptive hint explaining the arrows used to represent
# code object grades
#
# @return [String]
def description_hint_grades
grades = Evaluation::Grade.all
- "School grades (#{grades.join(', ')}) are assigned and " +
+ "School grades (#{grades.join(", ")}) are assigned and " \
"displayed with each object."
end
- DEFAULT_PATHS = ["{lib,app}/**/*.rb", "ext/**/*.c"]
-
def get_paths(args)
# @yard_files is assigned by YardoptsHelper#parse_yardopts_options
- paths = @yard_files ? @yard_files : args.dup
- if paths.empty?
- DEFAULT_PATHS
- else
- paths
- end
+ @yard_files ? @yard_files : args.dup
end
# Adds a set of common options to the tail of the OptionParser
#
# @param [OptionParser] opts the option parser object
# @return [void]
def common_options(opts)
opts.separator ""
opts.separator "Other options:"
opts.on("--[no-]color", "Run without color") do |v|
- Term::ANSIColor::coloring = v
+ Term::ANSIColor.coloring = v
end
- opts.on_tail('-v', '--version', 'Show version.') do
+ opts.on_tail("-v", "--version", "Show version.") do
ui.trace "inch #{Inch::VERSION}"
exit
end
- opts.on_tail('-h', '--help', 'Show this help.') do
+ opts.on_tail("-l", "--language [LANGUAGE]", "Set language (ruby|nodejs).") do |language|
+ @language = language
+ end
+ opts.on_tail("-r", "--read-from-dump [FILE]", "Read objects from dump.") do |file|
+ @read_dump_file = file
+ end
+ opts.on_tail("-h", "--help", "Show this help.") do
ui.trace opts
exit
end
end
@@ -163,10 +164,10 @@
end
# Resets the command-line interface before each run
def reset
# color is enabled by default, can be turned of by switch --no-color
- Term::ANSIColor::coloring = true
+ Term::ANSIColor.coloring = true
end
# Callback when an unrecognize option is parsed
#
# @param [OptionParser::ParseError] err the exception raised by the