2using System.Collections.Generic;
4using System.Threading.Tasks;
6using Nuke.Common.Utilities;
7using Nuke.Common.Utilities.Collections;
21 if (
string.IsNullOrWhiteSpace(arg))
return arg;
23 arg = arg.TrimMatchingDoubleQuotes()
27 arg =
string.Concat(
"-", arg.AsSpan(1));
34 public static IEnumerable<string?>
AsArguments(
this IEnumerable<string>? args)
40 public static string AppendAsArguments(
this IEnumerable<string>? input,
bool leadingSpace =
true)
41 => (input?.IsEmpty() ??
true)
43 : (leadingSpace ?
" " :
"") +
string.Join(
' ', input?.Select(
ProcessArgument) ?? Enumerable.Empty<
string>());
64 public static IEnumerable<string>
GetBlock(
string name =
"", IEnumerable<string>? from =
null)
66 var args = from ?? EnvironmentInfo.CommandLineArguments;
68 .SkipUntil(a => a ==
"-->" + name)
70 .TakeUntil(a => a.StartsWith(
"-->"));
Extension class for dealing with passing arguments from the user through nuke to a tool.
static IEnumerable< string > GetBlock(string name="", IEnumerable< string >? from=null)
Gets an optionally named block of arguments. An argument block starts with "-->" (+ optional name) an...
static IEnumerable< string?> AsArguments(this IEnumerable< string >? args)
Unescape multiple argument input which is passed by the user through a parameter.
static IEnumerable< string > GetArgumentBlock(this IEnumerable< string > from, string name="")
Gets an optionally named block of arguments. An argument block starts with "-->" (+ optional name) an...
static string AppendAsArguments(this IEnumerable< string >? input, bool leadingSpace=true)
Unescape multiple argument input which is passed by the user through a parameter.
static ? string ProcessArgument(string? arg)
Unescape argument input which is passed by the user through a parameter.