Sha256: 047b863f6f7fbebda60983f503b4757524aeeb75cb796a47786a00bff2c3c82d

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

require 'rubygems'
require 'commander'

module AMazeIng
  class CLI
    include Commander::Methods    
    
    def run
      @full_screen = false

      # program :name, AMazeIng::Configuration::PROGRAM_NAME 
      program :name, "AMazeIng"
      program :version, AMazeIng::VERSION
      # program :description, AMazeIng::Configuration::DESCRIPTION 
      program :description, "Maze solving game... don't be addicted" 

      default_command :classic

      global_option('-f', '--fullscreen', 'Render window at full screen') {
        @full_screen = true
      }

      command :classic do |c|
        c.syntax = 'a_maze_ing classic [options]'
        c.description = 'Classic mode, difficulty increase with level'
        c.action do 
          AMazeIng::GameWindow.new(@full_screen).show
        end
      end
      # command :bar do |c|
      #   c.syntax = 'foobar bar [options]'
      #   c.description = 'Display bar with optional prefix and suffix'
      #   c.option '-p', '--prefix STRING', String, 'Adds a prefix to bar'
      #   c.option '-s', '--suffix STRING', String, 'Adds a suffix to bar'
      #   c.action do |args, options|
      #     options.default :prefix => '(', :suffix => ')'
      #     say "#{options.prefix}bar#{options.suffix}"
      #   end
      # end

      run!
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
a_maze_ing-0.3.0 lib/a_maze_ing/cli.rb