예제 #1
0
 void process(final String option, final boolean is_last) {
   final int n = option.indexOf('=');
   String opt;
   String arg;
   if (n >= 0) {
     opt = option.substring(0, n);
     arg = option.substring(n + 1);
   } else {
     opt = option;
     arg = null;
   }
   if (opt.equals("--banner")) {
     this.banner = arg == null || arg.equals("on");
   } else if (opt.equals("--prompt")) {
     this.prompt = arg == null ? "" : arg;
   } else if (opt.equals("--jline")) {
     this.jline = arg == null || arg.equals("on");
   } else if (opt.equals("--splash")) {
     this.splash = arg == null || arg.equals("on");
   } else if (opt.equals("--help")) {
     this.help = arg == null || arg.equals("on");
   } else if (opt.equals("--version")) {
     this.version = arg == null || arg.equals("on");
   } else if (opt.equals("--personal")) {
     this.personal = arg == null || arg.equals("on");
   } else {
     //	Mode options
     final Mode m = Mode.tryNewMode(opt);
     if (m != null) {
       final boolean def = m.isInteractive();
       this.banner = def;
       this.jline = def;
       this.personal = def;
       this.mode = m;
     } else if (opt.startsWith("-")) {
       new Alert("Unrecognized option").culprit("option", option).mishap();
     } else if (is_last) {
       if (Print.wouldPrint(Print.VFS)) Print.println("Got inventory: " + option);
       try {
         this.inventory = new URL(option);
       } catch (MalformedURLException e) {
         throw new RuntimeException(e);
       }
     }
   }
 }