Beispiel #1
0
			public static IodineOptions Parse (string[] args)
			{
				IodineOptions ret = new IodineOptions ();
				int i;
				for (i = 0; i < args.Length; i++) {
					if (args [i].StartsWith ("-")) {
						ret.Options.Add (args [i].Substring (1));
					} else {
						ret.FileName = args [i++];
						if (!File.Exists (ret.FileName)) {
							Panic ("Could not find file {0}!", ret.FileName);
						}
						break;
					}
				}
				IodineObject[] arguments = new IodineObject [args.Length - i];
				int start = i;
				for (; i < args.Length; i++) {
					arguments [i - start] = new IodineString (args [i]);
				}
				ret.IodineArguments = new IodineList (arguments);
				return ret;
			}
Beispiel #2
0
 public static IodineOptions Parse(string[] args)
 {
     IodineOptions ret = new IodineOptions ();
     int i;
     for (i = 0; i < args.Length; i++) {
         if (args [i].StartsWith ("-")) {
             switch (args [i]) {
             case "version":
             case "v":
                 ret.ShowVersion = true;
                 break;
             default:
                 Panic ("Unknown command line argument '{0}'", args [i]);
                 break;
             }
         } else {
             ret.FileName = args [i++];
             if (!System.IO.File.Exists (ret.FileName)) {
                 Panic ("Could not find file {0}!", ret.FileName);
             }
             break;
         }
     }
     IodineObject[] arguments = new IodineObject [args.Length - i];
     int start = i;
     for (; i < args.Length; i++) {
         arguments [i - start] = new IodineString (args [i]);
     }
     ret.Arguments = new IodineList (arguments);
     return ret;
 }