Specify alternate run control file path from CLI
This commit is contained in:
parent
7493ab3284
commit
62c824cd7d
9
features/cli/run_control.feature
Normal file
9
features/cli/run_control.feature
Normal file
@ -0,0 +1,9 @@
|
||||
Feature: run control file path CLI option
|
||||
|
||||
Scenario: changes the path to run control file
|
||||
Given a file named uhwmrc.rb with:
|
||||
"""
|
||||
puts 'run control evaluation'
|
||||
"""
|
||||
When I run uhwm with option -f uhwmrc.rb
|
||||
Then the output must contain "run control evaluation"
|
@ -6,6 +6,7 @@ options:
|
||||
-h, --help print this message
|
||||
-v, --version enable verbose mode
|
||||
-d, --debug enable debug mode
|
||||
-f, --run-control PATH specify alternate run control file
|
||||
-r, --require PATH require ruby feature
|
||||
-l, --layout LAYOUT specify layout
|
||||
eoh
|
||||
|
@ -64,6 +64,11 @@ module Uh
|
||||
@env.log_logger_level
|
||||
end
|
||||
|
||||
opts.on '-f', '--run-control PATH',
|
||||
'specify alternate run control file' do |e|
|
||||
@env.rc_path = e
|
||||
end
|
||||
|
||||
opts.on '-r', '--require PATH', 'require ruby feature' do |feature|
|
||||
require feature
|
||||
@env.log "Loaded `#{feature}' ruby feature"
|
||||
|
@ -148,6 +148,15 @@ module Uh
|
||||
end
|
||||
end
|
||||
|
||||
context 'with run control option' do
|
||||
let(:arguments) { %w[-f uhwmrc.rb] }
|
||||
|
||||
it 'assigns run control file path in the env' do
|
||||
cli.parse_arguments!
|
||||
expect(cli.env.rc_path).to eq 'uhwmrc.rb'
|
||||
end
|
||||
end
|
||||
|
||||
context 'with require option' do
|
||||
let(:arguments) { %w[-r abbrev] }
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user