Changeset 792
- Timestamp:
- 07/07/08 23:23:25 (5 months ago)
- Files:
-
- trunk/phobos/std/getopt.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/getopt.d
r714 r792 386 386 // no more options to look for, potentially some arguments left 387 387 foreach (a ; args[1 .. $]) { 388 if (!a.length || a[0] != '-')388 if (!a.length || a[0] != optChar) 389 389 { 390 390 // not an option … … 392 392 continue; 393 393 } 394 if ( a == endOfOptions) break; // end of options394 if (endOfOptions.length && a == endOfOptions) break; 395 395 if (!cfg.passThrough) 396 396 { … … 407 407 for (size_t i = 1; i < args.length; ) { 408 408 auto a = args[i]; 409 if ( a == endOfOptions) break; // end of options, i.e. "--"409 if (endOfOptions.length && a == endOfOptions) break; 410 410 if (cfg.stopOnFirstNonOption && (!a.length || a[0] != optChar)) 411 411 { … … 469 469 alias typeof(receiver.keys[0]) K; 470 470 alias typeof(receiver.values[0]) V; 471 auto j = std.string.find(val, '=');471 auto j = std.string.find(val, assignChar); 472 472 auto key = val[0 .. j], value = val[j + 1 .. $]; 473 473 (*receiver)[to!(K)(key)] = to!(V)(value); … … 482 482 } 483 483 484 enum 485 optChar = '-', 486 assignChar = '=', 487 autoIncrementChar = '+', 488 endOfOptions = "--"; 484 /** 485 The option character. Defaults to '-' but it can be assigned to 486 prior to calling $(D getopt). 487 */ 488 dchar optChar = '-'; 489 490 /** 491 The string that conventionally marks the end of all 492 options. Defaults to "--" but can be assigned to prior to calling 493 $(D getopt). Assigning an empty string to $(D endOfOptions) 494 effectively disables it. 495 */ 496 string endOfOptions = "--"; 497 498 /** 499 The assignment character used in options with parameters. Defaults 500 to '=' but can be assigned to prior to calling $(D getopt). 501 */ 502 dchar assignChar = '='; 503 504 enum autoIncrementChar = '+'; 489 505 490 506 private struct configuration
