Class: CommandLine::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/git/contest/command_line/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(new_args, new_input_stream = STDIN) ⇒ Command

Returns a new instance of Command.



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/git/contest/command_line/command.rb', line 30

def initialize(new_args, new_input_stream = STDIN)
  @input_stream = new_input_stream
  @terminal = ::HighLine.new(new_input_stream)
  init_global # TODO: remove
  init_home   # TODO:remove
  @args = new_args.clone
  @options = {}
  @tokens = [] # init after parse options
  @opt_parser = OptionParser.new do |opt|
    opt.version = Git::Contest::VERSION
  end
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



25
26
27
# File 'lib/git/contest/command_line/command.rb', line 25

def args
  @args
end

#input_streamObject (readonly)

Returns the value of attribute input_stream.



23
24
25
# File 'lib/git/contest/command_line/command.rb', line 23

def input_stream
  @input_stream
end

#opt_parserObject (readonly)

Returns the value of attribute opt_parser.



28
29
30
# File 'lib/git/contest/command_line/command.rb', line 28

def opt_parser
  @opt_parser
end

#optionsObject (readonly)

Returns the value of attribute options.



27
28
29
# File 'lib/git/contest/command_line/command.rb', line 27

def options
  @options
end

#terminalObject (readonly)

Returns the value of attribute terminal.



24
25
26
# File 'lib/git/contest/command_line/command.rb', line 24

def terminal
  @terminal
end

#tokensObject (readonly)

Returns the value of attribute tokens.



26
27
28
# File 'lib/git/contest/command_line/command.rb', line 26

def tokens
  @tokens
end

Instance Method Details

#define_optionsObject



43
44
45
# File 'lib/git/contest/command_line/command.rb', line 43

def define_options
  raise "not implement"
end

#initObject



51
52
53
54
55
56
# File 'lib/git/contest/command_line/command.rb', line 51

def init
  define_options
  parse_line_options
  @tokens = args
  set_default_options
end

#runObject



58
59
60
# File 'lib/git/contest/command_line/command.rb', line 58

def run
  raise "not implement"
end

#set_default_optionsObject



47
48
49
# File 'lib/git/contest/command_line/command.rb', line 47

def set_default_options
  raise "not implement"
end