Class: Wagn::Commands::Command
- Inherits:
-
Object
- Object
- Wagn::Commands::Command
show all
- Defined in:
- lib/wagn/commands/command.rb
Instance Method Summary
collapse
Instance Method Details
#exit_with_child_status(command) ⇒ Object
9
10
11
12
|
# File 'lib/wagn/commands/command.rb', line 9
def exit_with_child_status command
command += " 2>&1"
exit $CHILD_STATUS.exitstatus unless system command
end
|
#run ⇒ Object
4
5
6
7
|
# File 'lib/wagn/commands/command.rb', line 4
def run
puts command
exit_with_child_status command
end
|
#split_args(args) ⇒ Object
split special wagn args and original command args separated by ‘–’
15
16
17
18
19
20
21
22
23
|
# File 'lib/wagn/commands/command.rb', line 15
def split_args args
before_split = true
wagn_args, command_args =
args.partition do |a|
before_split = (a == "--" ? false : before_split)
end
command_args.shift
[wagn_args, command_args]
end
|