Class: FileReplicator::AbstractCmdParse
- Inherits:
-
Object
- Object
- FileReplicator::AbstractCmdParse
show all
- Defined in:
- lib/file_replicator/abstract_cmd_parse.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of AbstractCmdParse.
11
12
13
|
# File 'lib/file_replicator/abstract_cmd_parse.rb', line 11
def initialize
@colour = Pastel.new
end
|
Instance Method Details
#get_options ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/file_replicator/abstract_cmd_parse.rb', line 15
def get_options
options = parse_argv
if ARGV.empty?
puts options
exit
end
validate options
options
rescue MissingArgumentException,
ArgumentError,
Slop::MissingArgument,
Slop::UnknownOption => e
puts @colour.bright_red e.message
exit 1
end
|
35
36
37
|
# File 'lib/file_replicator/abstract_cmd_parse.rb', line 35
def (txt)
@colour.yellow.bold.underline txt
end
|
#highlight(txt) ⇒ Object
39
40
41
|
# File 'lib/file_replicator/abstract_cmd_parse.rb', line 39
def highlight(txt)
@colour.green.bold txt
end
|
#parse_argv ⇒ Object
43
44
45
|
# File 'lib/file_replicator/abstract_cmd_parse.rb', line 43
def parse_argv
raise 'Implementation missing'
end
|
#validate(options) ⇒ Object
47
48
49
|
# File 'lib/file_replicator/abstract_cmd_parse.rb', line 47
def validate(options)
raise 'Implementation missing'
end
|