dotnet-installer/src/Microsoft.DotNet.Tools.Run/Program.cs

47 lines
1.7 KiB
C#
Raw Normal View History

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
2015-10-30 15:40:13 -07:00
using Microsoft.DotNet.Cli.Utils;
using System;
using System.CommandLine;
2015-10-30 15:40:13 -07:00
2015-11-01 02:46:05 -08:00
namespace Microsoft.DotNet.Tools.Run
2015-10-30 15:40:13 -07:00
{
public class Program
{
public static int Main(string[] args)
{
DebugHelper.HandleDebugSwitch(ref args);
RunCommand runCmd = new RunCommand();
2015-10-30 15:40:13 -07:00
ArgumentSyntax.Parse(args, syntax =>
2015-10-30 15:40:13 -07:00
{
syntax.HandleErrors = false;
syntax.DefineOption("f|framework", ref runCmd.Framework, "Compile a specific framework");
syntax.DefineOption("c|configuration", ref runCmd.Configuration, "Configuration under which to build");
syntax.DefineOption("t|preserve-temporary", ref runCmd.PreserveTemporary, "Keep the output's temporary directory around");
syntax.DefineOption("p|project", ref runCmd.Project, "The path to the project to run (defaults to the current directory). Can be a path to a project.json or a project directory");
// TODO: this is not supporting args which can be switches (i.e. --test)
// TODO: we need to make a change in System.CommandLine or parse args ourselves.
syntax.DefineParameterList("args", ref runCmd.Args, "Arguments to pass to the executable or script");
2015-10-30 15:40:13 -07:00
});
try
{
return runCmd.Start();
2015-10-30 15:40:13 -07:00
}
catch (Exception ex)
{
#if DEBUG
Console.Error.WriteLine(ex);
#else
Console.Error.WriteLine(ex.Message);
#endif
return 1;
}
}
}
}