- S-Core Co., Ltd
=end
+$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
require 'optparse'
+require 'utils'
def option_error_check( options )
case options[:cmd]
raise ArgumentError, "Input is incorrect : #{options[:cmd]}"
end
+ if ARGV.length > 1 then
+ raise ArgumentError, "Unknown argument value : #{ARGV[1]}"
+ end
end
-def option_parse
+def option_parse
options = {}
banner = "Requiest service to build-server command-line tool." + "\n" \
+ "\n" + "Usage: build-cli <SUBCOMMAND> [OPTS] or build-cli -h" + "\n" \
options[:os] = nil
opts.on( '-o', '--os <operating system>', 'target operating system: ubuntu-32/ubuntu-64/windows-32/windows-64/macos-64' ) do |os|
+ if not Utils.multi_argument_test( os, "," ) then
+ puts "OS variable parsing error : #{os}"
+ exit
+ end
options[:os] = os
end
- S-Core Co., Ltd
=end
+$LOAD_PATH.unshift File.dirname(__FILE__)+"/src/common"
require 'optparse'
+require 'utils'
def option_error_check( options )
case options[:cmd]
end
options[:os] = nil
- opts.on( '-o', '--os <target os list>', 'ex) linux,windows' ) do|os|
+ opts.on( '-o', '--os <target os list>', 'ex) linux-32,windows-32' ) do|os|
+ if not Utils.multi_argument_test( os, "," ) then
+ puts "OS variable parsing error : #{os}"
+ exit
+ end
options[:os] = os
end
return nil
end
+ def Utils.multi_argument_test( arg, seperator )
+ return ( not arg.end_with? seperator and not arg.split( seperator ).select{|x| x.empty?}.length > 0 )
+ end
+
if defined?(HOST_OS).nil? then
HOST_OS = Utils.identify_current_OS()
end
opts.on( '-P', '--pkgs <package file list>', 'package file path list' ) do|pkgs|
+ if not Utils.multi_argument_test( pkgs, "," ) then
+ puts "Package variable parsing error : #{pkgs}"
+ exit
+ end
list = pkgs.tr(" \t","").split(",")
list.each do |l|
if l.start_with? "~" then l = Utils::HOME + l.delete("~") end
end
opts.on( '-s', '--snapshot <snapshot>', 'a snapshot name or snapshot list' ) do|snaplist|
+ if not Utils.multi_argument_test( snaplist, "," ) then
+ puts "Snapshot variable parsing error : #{snaplist}"
+ exit
+ end
options[:snaps] = snaplist.split(",")
end