Method: YARD::CLI::Yardoc#parse_arguments

Defined in:
lib/yard/cli/yardoc.rb

#parse_arguments(*args) ⇒ Boolean

Parses commandline arguments

Parameters:

Returns:

  • (Boolean)

    whether or not arguments are valid

Since:

  • 0.5.6



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# File 'lib/yard/cli/yardoc.rb', line 291

def parse_arguments(*args)
  super(*args)

  # Last minute modifications
  self.files = Parser::SourceParser::DEFAULT_PATH_GLOB if files.empty?
  files.delete_if {|x| x =~ /\A\s*\Z/ } # remove empty ones
  readme = Dir.glob('README{,*[^~]}').
    sort_by {|r| [r.count('.'), r.index('.'), r] }.first
  readme ||= Dir.glob(files.first).first if options.onefile && !files.empty?
  options.readme ||= CodeObjects::ExtraFileObject.new(readme) if readme
  options.files.unshift(options.readme).uniq! if options.readme

  Tags::Library.visible_tags -= hidden_tags
  add_visibility_verifier
  add_api_verifier

  apply_locale

  # US-ASCII is invalid encoding for onefile
  if defined?(::Encoding) && options.onefile
    if ::Encoding.default_internal == ::Encoding::US_ASCII
      log.warn "--one-file is not compatible with US-ASCII encoding, using ASCII-8BIT"
      ::Encoding.default_external, ::Encoding.default_internal = ['ascii-8bit'] * 2
    end
  end

  if generate && !verify_markup_options
    false
  else
    true
  end
end