move dotnet-run

This commit is contained in:
Piotr Puszkiewicz 2017-03-10 10:13:11 -08:00
parent a751673172
commit 940dd6863a
4 changed files with 27 additions and 13 deletions

View file

@ -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();
}
}
}

View file

@ -39,6 +39,11 @@ namespace Microsoft.DotNet.Cli
}
public override string ToString() => _value;
public static explicit operator string(ForwardedArgument argument)
{
return argument.ToString();
}
}
}
}

View file

@ -19,9 +19,9 @@ namespace Microsoft.DotNet.Cli
{
return new RunCommand()
{
Configuration = o.ValueOrDefault<string>("--configuration"),
Framework = o.ValueOrDefault<string>("--framework"),
Project = o.ValueOrDefault<string>("--project"),
Configuration = o.SingleArgumentOrDefault("--configuration"),
Framework = o.SingleArgumentOrDefault("--framework"),
Project = o.SingleArgumentOrDefault("--project"),
Args = (IReadOnlyList<string>)o.Arguments
};
}),