/// <inheritdoc /> public override bool HandleOption(CommandLineUtilities.Option opt) { if (m_outputFileOption.Match(opt.Name)) { m_outputFile = CommandLineUtilities.ParsePathOption(opt); return(true); } if (m_descriptionOption.Match(opt.Name)) { m_description = opt.Value; return(true); } if (m_alternateSymbolSeparatorOption.Match(opt.Name)) { var alternateSymbolSeparatorString = CommandLineUtilities.ParseStringOption(opt); m_alternateSymbolSeparator = alternateSymbolSeparatorString.Length != 0 ? alternateSymbolSeparatorString[0] : default; return(true); } if (m_topSortOption.Match(opt.Name)) { SerializeUsingTopSort = CommandLineUtilities.ParseBooleanOption(opt); return(true); } return(base.HandleOption(opt)); }
/// <inheritdoc /> public override bool HandleOption(CommandLineUtilities.Option opt) { if (string.Equals(OutputFolderOptionLong, opt.Name, StringComparison.OrdinalIgnoreCase) || string.Equals(OutputFolderOptionShort, opt.Name, StringComparison.OrdinalIgnoreCase)) { OutputFolder = CommandLineUtilities.ParsePathOption(opt); return(true); } if (string.Equals(RootLinkOptionLong, opt.Name, StringComparison.OrdinalIgnoreCase) || string.Equals(RootLinkOptionShort, opt.Name, StringComparison.OrdinalIgnoreCase)) { RootLink = CommandLineUtilities.ParseStringOption(opt); return(true); } if (string.Equals(CleanOutputOptionLong, opt.Name, StringComparison.OrdinalIgnoreCase) || string.Equals(CleanOutputOptionShort, opt.Name, StringComparison.OrdinalIgnoreCase)) { CleanOutputFolder = CommandLineUtilities.ParseBooleanOption(opt); return(true); } if (string.Equals(ModuleListOptionLong, opt.Name, StringComparison.OrdinalIgnoreCase) || string.Equals(ModuleListOptionShort, opt.Name, StringComparison.OrdinalIgnoreCase)) { ModuleList = new HashSet <string>(CommandLineUtilities.ParseStringOption(opt).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); return(true); } return(base.HandleOption(opt)); }
public void PathOption() { CommandLineUtilities.Option opt = default(CommandLineUtilities.Option); opt.Name = "Switch"; opt.Value = "test.dll"; Assert.Equal(Path.Combine(Directory.GetCurrentDirectory(), "test.dll"), CommandLineUtilities.ParsePathOption(opt)); // Paths may be wrapped in quotes opt.Value = "\"File With Spaces.dll\""; Assert.Equal(Path.Combine(Directory.GetCurrentDirectory(), "File With Spaces.dll"), CommandLineUtilities.ParsePathOption(opt)); if (!OperatingSystemHelper.IsUnixOS) { opt.Name = "Switch"; opt.Value = SpecialFolderUtilities.GetFolderPath(SpecialFolder.Windows); Assert.Equal(opt.Value, CommandLineUtilities.ParsePathOption(opt)); } Assert.Throws <InvalidArgumentException>(() => { opt.Name = "Switch"; opt.Value = null; CommandLineUtilities.ParsePathOption(opt); }); Assert.Throws <InvalidArgumentException>(() => { opt.Name = "Switch"; opt.Value = string.Empty; CommandLineUtilities.ParsePathOption(opt); }); }
public override bool HandleOption(CommandLineUtilities.Option opt) { if (opt.Name.Equals("out", StringComparison.OrdinalIgnoreCase) || opt.Name.Equals("o", StringComparison.OrdinalIgnoreCase)) { m_outputDirectory = CommandLineUtilities.ParsePathOption(opt); return(true); } return(base.HandleOption(opt)); }
/// <inheritdoc /> public override bool HandleOption(CommandLineUtilities.Option opt) { if (m_outputFileOption.Match(opt.Name)) { m_outputFile = CommandLineUtilities.ParsePathOption(opt); return(true); } if (m_descriptionOption.Match(opt.Name)) { m_description = opt.Value; return(true); } return(base.HandleOption(opt)); }