Пример #1
0
        /// <summary>
        /// CodeCakeBuilder entry point. This is a default, simple, implementation that can
        /// be extended as needed.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        /// <returns>An error code (typically negative), 0 on success.</returns>
        static int Main(string[] args)
        {
            string solutionDirectory = args.Contains(SolutionDirectoryIsCurrentDirectoryParameter, StringComparer.OrdinalIgnoreCase)
                                        ? Environment.CurrentDirectory
                                        : null;
            CodeCakeApplication app    = new CodeCakeApplication(solutionDirectory);
            RunResult           result = default;

            try
            {
                result = app.Run(args.Where(a => !StringComparer.OrdinalIgnoreCase.Equals(a, SolutionDirectoryIsCurrentDirectoryParameter)));
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            if (result.InteractiveMode == InteractiveMode.Interactive)
            {
                Console.WriteLine();
                Console.WriteLine($"Hit any key to exit.");
                Console.WriteLine($"Use -{InteractiveAliases.NoInteractionArgument} or -{InteractiveAliases.AutoInteractionArgument} parameter to exit immediately.");
                Console.ReadKey();
            }
            return(result.ReturnCode);
        }
Пример #2
0
        /// <summary>
        /// CodeCakeBuilder entry point. This is a default, simple, implementation that can
        /// be extended as needed.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        /// <returns>An error code (typically negative), 0 on success.</returns>
        static async Task <int> Main(string[] args)
        {
            string?solutionDirectory = args.Contains(SolutionDirectoryIsCurrentDirectoryParameter, StringComparer.OrdinalIgnoreCase)
                                        ? Environment.CurrentDirectory
                                        : null;
            var       app    = new CodeCakeApplication(solutionDirectory);
            RunResult result = await app.RunAsync(args.Where(a => !StringComparer.OrdinalIgnoreCase.Equals(a, SolutionDirectoryIsCurrentDirectoryParameter)));

            return(result.ReturnCode);
        }
Пример #3
0
 static void Main( string[] args )
 {
     var app = new CodeCakeApplication();
     app.Run( args );
     // From: http://stackoverflow.com/questions/1188658/how-can-a-c-sharp-windows-console-application-tell-if-it-is-run-interactively
     if( Console.OpenStandardInput( 1 ) != Stream.Null )
     {
         Console.WriteLine();
         Console.WriteLine( "Interactive mode detected: hit any key to exit." );
         Console.ReadKey();
     }
 }
Пример #4
0
 /// <summary>
 /// CodeCakeBuilder entry point. This is a default, simple, implementation that can 
 /// be extended as needed.
 /// </summary>
 /// <param name="args"></param>
 /// <returns>An error code (typically -1), 0 on success.</returns>
 static int Main( string[] args )
 {
     var app = new CodeCakeApplication();
     bool interactive = !args.Contains( '-' + InteractiveAliases.NoInteractionArgument, StringComparer.OrdinalIgnoreCase );
     int result = app.Run( args );
     Console.WriteLine();
     if( interactive )
     {
         Console.WriteLine( "Hit any key to exit. (Use -{0} parameter to exit immediately)", InteractiveAliases.NoInteractionArgument );
         Console.ReadKey();
     }
     return result;
 }
Пример #5
0
        static void Main(string[] args)
        {
            var app = new CodeCakeApplication();

            app.Run(args);
            // From: http://stackoverflow.com/questions/1188658/how-can-a-c-sharp-windows-console-application-tell-if-it-is-run-interactively
            if (Console.OpenStandardInput(1) != Stream.Null)
            {
                Console.WriteLine();
                Console.WriteLine("Interactive mode detected: hit any key to exit.");
                Console.ReadKey();
            }
        }
        /// <summary>
        /// CodeCakeBuilder entry point. This is a default, simple, implementation that can
        /// be extended as needed.
        /// </summary>
        /// <param name="args"></param>
        /// <returns>An error code (typically -1), 0 on success.</returns>
        static int Main(string[] args)
        {
            var  app         = new CodeCakeApplication();
            bool interactive = !args.Contains('-' + InteractiveAliases.NoInteractionArgument, StringComparer.OrdinalIgnoreCase);
            int  result      = app.Run(args);

            Console.WriteLine();
            if (interactive)
            {
                Console.WriteLine("Hit any key to exit. (Use -{0} parameter to exit immediately)", InteractiveAliases.NoInteractionArgument);
                Console.ReadKey();
            }
            return(result);
        }
Пример #7
0
        /// <summary>
        /// CodeCakeBuilder entry point. This is a default, simple, implementation that can
        /// be extended as needed.
        /// </summary>
        /// <param name="args">The command line arguments.</param>
        /// <returns>An error code (typically negative), 0 on success.</returns>
        static int Main(string[] args)
        {
            var       app    = new CodeCakeApplication();
            RunResult result = app.Run(args);

            if (result.InteractiveMode == InteractiveMode.Interactive)
            {
                Console.WriteLine();
                Console.WriteLine($"Hit any key to exit.");
                Console.WriteLine($"Use -{InteractiveAliases.NoInteractionArgument} or -{InteractiveAliases.AutoInteractionArgument} parameter to exit immediately.");
                Console.ReadKey();
            }
            return(result.ReturnCode);
        }