Class: GamesAndRpgParadise::Commandline

Inherits:
Base
  • Object
show all
Defined in:
lib/games_and_rpg_paradise/commandline/commandline.rb

Overview

GamesAndRpgParadise::Commandline

Constant Summary

Constants included from Base::Extensions::Colours

Base::Extensions::Colours::ARRAY_AVAILABLE_KONSOLE_COLOURS

Constants included from CommonExtensions

GamesAndRpgParadise::CommonExtensions::CONTROL_C_CODE, GamesAndRpgParadise::CommonExtensions::N

Instance Method Summary collapse

Methods included from Base::Extensions::Colours

ecomment, #efancy, #eparse, #forestgreen, #gold, #grey, #lightblue, #mediumseagreen, #mediumslateblue, #peru, #rev, sdir, sfancy, #sfile, simp, #teal, #yellow

Methods included from Base::Extensions::CommandlineArguments

#commandline_arguments?, #filter_away_commandline_arguments, #first_argument?, #first_non_hyphened_argument?, #set_commandline_arguments

Methods included from CommonExtensions

#cat, #cd, #cliner, #copy_file, #delete, #dirname_but_retains_the_trailing_slash, #disable_colours, #ensure_that_the_log_directory_exists, #esystem, #get_user_input, #infer_the_namespace, #is_on_roebe?, #log_dir?, #mkdir, #mkdir_then_cd_into_it, #mv, #namespace?, #opne, #opnn, #project_base_directory?, #project_image_directory?, #project_yaml_directory?, #rds, #register_sigint, #remove_this_directory, #rename_file, #reset, #reset_the_internal_hash, #return_pwd, #return_today, #touch_file, #wrap, #write_what_into

Constructor Details

#initialize(i = ARGV, run_already = true) ⇒ Commandline

#

initialize

#


27
28
29
30
31
32
33
34
# File 'lib/games_and_rpg_paradise/commandline/commandline.rb', line 27

def initialize(
    i           = ARGV,
    run_already = true
  )
  reset
  set_commandline_arguments(i)
  run if run_already
end

Instance Method Details

#do_start_vier_gewinntObject

#

do_start_vier_gewinnt

#


112
113
114
115
# File 'lib/games_and_rpg_paradise/commandline/commandline.rb', line 112

def do_start_vier_gewinnt
  require 'games_and_rpg_paradise/games/vier_gewinnt/vier_gewinnt.rb'
  GamesAndRpgParadise::VierGewinnt.new(ARGV)
end
#

menu (menu tag)

#


50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/games_and_rpg_paradise/commandline/commandline.rb', line 50

def menu(
    i = commandline_arguments?
  )
  if i.is_a? Array
    if i.empty?
      output_complete_random_male_tai_name # This is the default if no arguments were given to this class.
    else
      i.each {|entry|
        menu(entry)
      }
    end
  else
    case i # case tag
    # ===================================================================== #
    # === gamebook3
    #
    # rpg_paradise --gamebook3
    # ===================================================================== #
    when /-?-?g?e?n?(-|_| )?gamebook\d{1,3}$/
      RpgParadise::GenerateHtmlGamebook.new(i)
      exit
    # ===================================================================== #
    # === gamebook3
    #
    # rpgparadise --create-static-html-file-for=3
    # ===================================================================== #
    when /-?-?create(-|_| )?static(-|_| )?html(-|_| )?file(-|_| )?for=(\d+)$/i # === $5
      RpgParadise::GenerateHtmlGamebook.new($5) { :single }
      exit
    # ===================================================================== #
    # === games_paradise --vier-gewinnt
    # ===================================================================== #
    when /-?-?vier(-|_| )?gewinnt?$/i
      do_start_vier_gewinnt
    # ===================================================================== #
    # === games_paradise --help
    # ===================================================================== #
    when /-?-?help$/i
      show_help
      exit
    else
      if i.include? '--'
        e "Unknown entry: #{i}"
      else
        output_complete_random_male_tai_name
      end
    end
  end
end

#output_complete_random_male_tai_nameObject

#

output_complete_random_male_tai_name

#


103
104
105
106
107
# File 'lib/games_and_rpg_paradise/commandline/commandline.rb', line 103

def output_complete_random_male_tai_name
  e ::Colours.tomato(
      RpgParadise::Sarlem::Tai.complete_random_male_tai_name
    )
end

#runObject

#

run

#


120
121
122
# File 'lib/games_and_rpg_paradise/commandline/commandline.rb', line 120

def run
  menu(commandline_arguments?)
end

#show_helpObject

#

show_help (help tag)

#


39
40
41
42
43
44
45
# File 'lib/games_and_rpg_paradise/commandline/commandline.rb', line 39

def show_help
  e
  e '  --create-static-html-file-for=3 # create a static '\
    'HTML file for the third gamebook'
  e '  --vier-gewinnt                  # start the game "vier gewinnt"'
  e
end