move dotnet-run
This commit is contained in:
parent
a751673172
commit
940dd6863a
4 changed files with 27 additions and 13 deletions
|
@ -17,5 +17,14 @@ namespace Microsoft.DotNet.Cli
|
|||
.Select(o => o.Value<T>())
|
||||
.SingleOrDefault();
|
||||
}
|
||||
|
||||
public static string SingleArgumentOrDefault(this AppliedOption parseResult, string alias)
|
||||
{
|
||||
return parseResult
|
||||
.AppliedOptions
|
||||
.Where(o => o.HasAlias(alias))
|
||||
.Select(o => o.Arguments.Single())
|
||||
.SingleOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,12 @@ namespace Microsoft.DotNet.Cli
|
|||
_value = value;
|
||||
}
|
||||
|
||||
public override string ToString() => _value;
|
||||
public override string ToString() => _value;
|
||||
|
||||
public static explicit operator string(ForwardedArgument argument)
|
||||
{
|
||||
return argument.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,16 +15,16 @@ namespace Microsoft.DotNet.Cli
|
|||
"run",
|
||||
".NET Run Command",
|
||||
Accept.ZeroOrMoreArguments
|
||||
.MaterializeAs(o =>
|
||||
{
|
||||
return new RunCommand()
|
||||
.MaterializeAs(o =>
|
||||
{
|
||||
Configuration = o.ValueOrDefault<string>("--configuration"),
|
||||
Framework = o.ValueOrDefault<string>("--framework"),
|
||||
Project = o.ValueOrDefault<string>("--project"),
|
||||
Args = (IReadOnlyList<string>)o.Arguments
|
||||
};
|
||||
}),
|
||||
return new RunCommand()
|
||||
{
|
||||
Configuration = o.SingleArgumentOrDefault("--configuration"),
|
||||
Framework = o.SingleArgumentOrDefault("--framework"),
|
||||
Project = o.SingleArgumentOrDefault("--project"),
|
||||
Args = (IReadOnlyList<string>)o.Arguments
|
||||
};
|
||||
}),
|
||||
CommonOptions.HelpOption(),
|
||||
CommonOptions.ConfigurationOption(),
|
||||
CommonOptions.FrameworkOption(),
|
||||
|
|
|
@ -64,4 +64,4 @@ namespace Microsoft.DotNet.Tests.ParserTests
|
|||
.BeEquivalentTo("one");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue