public bool InitializeFromCommandLine(string[] args) { currentOption = null; foreach (string arg in args) { ArgumentOption nextOption = getOptionHandler(arg); if (nextOption != null) { currentOption = nextOption; if (currentOption.activator != null) currentOption.activator(this); continue; } if (currentOption == null) { PrintShortUsage(true); return false; } if (currentOption.handler != null) { currentOption.handler(this, arg); } else { throw new SettingsException("Unexpected argument for option '" + currentOption.key + "'"); } } if (settingsFile != null) { ReadSettingsFile(); } else if (generateSettingsFileName != null) { GenerateSettingsFile(); return false; } bool showShort = true; if (printLongHelp) { showShort = false; PrintVersion(); PrintShortUsage(false); PrintLongUsage(); } else if (printVersion) { PrintVersion(); } if (!string.IsNullOrEmpty(TargetPath)) return true; if (showShort) { PrintShortUsage(true); } return false; }
public bool InitializeFromCommandLine(string[] args) { currentOption = null; foreach (string arg in args) { ArgumentOption nextOption = getOptionHandler(arg); if (nextOption != null) { currentOption = nextOption; if (currentOption.activator != null) { currentOption.activator(this); } continue; } if (currentOption == null) { PrintShortUsage(true); return(false); } if (currentOption.handler != null) { currentOption.handler(this, arg); } else { throw new SettingsException("Unexpected argument for option '" + currentOption.key + "'"); } } if (settingsFile != null) { ReadSettingsFile(); } else if (generateSettingsFileName != null) { GenerateSettingsFile(); return(false); } bool showShort = true; if (printLongHelp) { showShort = false; PrintVersion(); PrintShortUsage(false); PrintLongUsage(); } else if (printVersion) { PrintVersion(); } if (!string.IsNullOrEmpty(TargetPath)) { return(true); } if (showShort) { PrintShortUsage(true); } return(false); }