instance method
SyntaxSuggest::Cli#parser
parser
lib/syntax_suggest/cli.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/syntax_suggest/cli.rb, line 81
def parser
@parser ||= OptionParser.new do |opts|
opts.banner = <<~EOM
Usage: syntax_suggest <file> [options]
Parses a ruby source file and searches for syntax error(s) such as
unexpected `end', expecting end-of-input.
Example:
$ syntax_suggest dog.rb
# ...
> 10 defdog
> 15 end
ENV options:
SYNTAX_SUGGEST_RECORD_DIR=<dir>
Records the steps used to search for a syntax error
to the given directory
Options:
EOM
opts.version = SyntaxSuggest::VERSION
opts.on("--help", "Help - displays this message") do |v|
@io.puts opts
options[:exit] = true
@exit_obj.exit
end
opts.on("--record <dir>", "Records the steps used to search for a syntax error to the given directory") do |v|
options[:record_dir] = v
end
opts.on("--terminal", "Enable terminal highlighting") do |v|
options[:terminal] = true
end
opts.on("--no-terminal", "Disable terminal highlighting") do |v|
options[:terminal] = false
end
end
end
No documentation available