Change Svi::Cli to a class
This commit is contained in:
parent
d9334aa224
commit
6f55b3ddae
4
exe/svi
4
exe/svi
@ -4,4 +4,6 @@ require "svi"
|
|||||||
|
|
||||||
args = ARGV.dup
|
args = ARGV.dup
|
||||||
|
|
||||||
exit(Svi::Cli.run(args))
|
cli = Svi::Cli.new
|
||||||
|
|
||||||
|
exit(cli.run(args))
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
require "yawpa"
|
require "yawpa"
|
||||||
|
|
||||||
module Svi
|
module Svi
|
||||||
module Cli
|
class Cli
|
||||||
class << self
|
|
||||||
|
|
||||||
ALIASES = {
|
ALIASES = {
|
||||||
"co" => "checkout",
|
"co" => "checkout",
|
||||||
@ -10,11 +9,11 @@ module Svi
|
|||||||
|
|
||||||
HELP_TEXT = <<EOS
|
HELP_TEXT = <<EOS
|
||||||
Usage: svi [options] <command> [parameters...]
|
Usage: svi [options] <command> [parameters...]
|
||||||
Global options:
|
Global options:
|
||||||
--version show svi version and exit
|
--version show svi version and exit
|
||||||
--help, -h show this help and exit
|
--help, -h show this help and exit
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
checkout/co check out Subversion URL
|
checkout/co check out Subversion URL
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
@ -47,7 +46,7 @@ EOS
|
|||||||
end
|
end
|
||||||
command_function = "cmd_#{subcommand}".to_sym
|
command_function = "cmd_#{subcommand}".to_sym
|
||||||
if private_methods.include?(command_function)
|
if private_methods.include?(command_function)
|
||||||
Cli.__send__(command_function, params)
|
__send__(command_function, params)
|
||||||
else
|
else
|
||||||
$stderr.puts "Unknown command #{subcommand}"
|
$stderr.puts "Unknown command #{subcommand}"
|
||||||
1
|
1
|
||||||
@ -72,5 +71,4 @@ EOS
|
|||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user