Sha256: b0a176ea1b921cb79490c1e94bd68c79ed2cf5d7f1c8a3de2aab2a7ddfaa9f67

Contents?: true

Size: 1.43 KB

Versions: 2

Compression:

Stored size: 1.43 KB

Contents

module Nutella

  class NutellaCLI
    
    NUTELLA_LOGO = "                   _       _ _
                  | |     | | |
       _ __  _   _| |_ ___| | | __ _
      |  _ \\| | | | __/ _ \\ | |/ _  |
      | | | | |_| | ||  __/ | | (_| |
      |_| |_|\\__,_|\\__\\___|_|_|\\__,_|
      "
    
    # Reads the parameters and executes commands
    def self.run
      # Read parameters
      args = ARGV.dup
      args.shift
      # Check that the command is not empty, if so, print the prompt
      command = ARGV.first
      if command == nil
        printPrompt
        exit 0
      end
      # Prepend warning if nutella is not ready
      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
      Nutella.executeCommand command, args
      exit 0
    end
  
    # Print Nutella logo
    def self.printPrompt
      console.info(NUTELLA_LOGO)
      nutella_version = File.open(NUTELLA_HOME+"VERSION", "rb").read
      console.info("Welcome to nutella version #{nutella_version}! For a complete lists of available commands type `nutella help`\n")
      # Append warning if nutella is not ready
      if (Nutella.config["ready"].nil?)
        console.warn "Looks like this is a fresh installation of nutella. Please run `nutella checkup` to check all dependencies are installed."
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nutella_framework-0.1.2 lib/cli/nutella_cli.rb
nutella_framework-0.1.0 lib/cli/nutella_cli.rb