public static void AppendSwitchIfTrue(this CommandLineBuilder commandLineBuilder, string switchName, bool value) { if (value) { commandLineBuilder.AppendSwitch(switchName); } }
/// <summary> /// Appends the switch if <paramref name="condition"/> is true. /// </summary> /// <param name="builder">The <see cref="CommandLineBuilder"/> to which the switch should be appended.</param> /// <param name="condition">The condition which must be met.</param> /// <param name="switchName">The switch name to append.</param> public static void AppendSwitchIfTrue(this CommandLineBuilder builder, bool condition, string switchName) { if (condition && !string.IsNullOrEmpty(switchName)) { builder.AppendSwitch(switchName); } }
public static void AppendSwitchIfNotNullOrEmpty(this CommandLineBuilder builder, string switchName) { Condition.Requires(builder, "builder").IsNotNull(); if (!String.IsNullOrEmpty(switchName)) builder.AppendSwitch(switchName); }
public static void AppendSwitchIfTrue(this CommandLineBuilder builder, string switchName, bool value) { Condition.Requires(builder, "builder").IsNotNull(); Condition.Requires(switchName, "switchName").IsNotNullOrEmpty(); if (value) builder.AppendSwitch(switchName); }
public static void AppendSwitchIfTrue(this CommandLineBuilder builder, string switchName, bool includeSwitch) { if (includeSwitch) builder.AppendSwitch(switchName); }