File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ def initialize(argv)
1212 @argv = argv
1313 end
1414
15+ def valid?
16+ init? ||
17+ !context_options . empty? ||
18+ !seperator_index . nil?
19+ end
20+
1521 def init?
1622 argv [ 0 ] == 'init'
1723 end
Original file line number Diff line number Diff line change @@ -23,19 +23,37 @@ def initialize(argv)
2323 end
2424
2525 def start
26+ validates
27+
2628 if command . init?
2729 init
2830 elsif command . all?
2931 run_all_contexts
3032 else
3133 run_a_specific_context
3234 end
35+ rescue OptionParser ::InvalidOption => e
36+ puts <<~ERROR
37+ #{ e . message }
38+ See 'matrixeval --help'
39+ ERROR
40+ exit
3341 ensure
3442 turn_on_stty_opost
3543 end
3644
3745 private
3846
47+ def validates
48+ return if command . valid?
49+
50+ puts <<~ERROR
51+ matrixeval: '#{ argv . join ( ' ' ) } ' is not a MatrixEval command.
52+ See 'matrixeval --help'
53+ ERROR
54+ exit
55+ end
56+
3957 def init
4058 Config ::YAML . create
4159 Gitignore . update
You can’t perform that action at this time.
0 commit comments