class Nutella::NutellaCLI

Constants

Public Class Methods

run() click to toggle source

Nutella entry point. Every time the “nutella” command is invoked this is the method that gets called. It reads the command line parameters and it invokes the right sub-command

# File lib/core/nutella_cli.rb, line 16
def self.run
  # Read parameters
  args = ARGV.dup
  args.shift

  # Check that the command is not empty, if so, simply print the nutella logo
  command = ARGV.first
  if command == nil
    print_nutella_logo
    exit 0
  end

  # If nutella is not ready to be used (i.e. nobody has invoked the "nutella checkup" command yet),
  # append warning/reminder message
  if Nutella.config['ready'].nil? && command!='checkup'
    console.warn 'Looks like this is a fresh installation of nutella. Please run \'nutella checkup\' to check all dependencies are installed.'
  end

  # Execute the appropriate command
  Nutella.execute_command command, args
  exit 0
end