Module: Sevgi::Binaries::Sevgi Private

Extended by:
Sevgi
Included in:
Sevgi
Defined in:
lib/sevgi/binaries/sevgi.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Implements the sevgi executable.

Constant Summary collapse

PROGNAME =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Executable name used in help output.

"sevgi"
Error =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Error raised for invalid command-line usage.

Class.new(::Sevgi::Error)

Instance Method Summary collapse

Instance Method Details

#call(argv) ⇒ nil

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Runs the sevgi command-line interface.

Parameters:

  • argv (Array<String>, String, nil)

    command-line arguments

Returns:

  • (nil)

Raises:

  • (Sevgi::Executor::Error)

    when --exception or SEVGI_VOMIT requests raw executor errors

  • (SystemExit)

    when argv does not match [options...] [--] [file|-] or script execution aborts



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/sevgi/binaries/sevgi.rb', line 80

def call(argv)
  return puts(help) if (options = Options.parse(argv = Array(argv))).help
  return puts(Skill.path) if options.skill
  return puts(::Sevgi::VERSION) if options.version

  file = operand(argv)
  handle(run(file, options), file, options)

rescue Skill::Error => e
  abort(e.message)
rescue Binaries::Sevgi::Error => e
  abort("#{e.message}\n\n#{help}")
end