Example #1
0
        private ICommand CreateCommand(CakeOptions options)
        {
            if (!options.HasError)
            {
                if (options.ShowHelp)
                {
                    return(_commandFactory.CreateHelpCommand());
                }
                if (options.ShowVersion)
                {
                    return(_commandFactory.CreateVersionCommand());
                }
                if (options.PerformDryRun)
                {
                    return(_commandFactory.CreateDryRunCommand());
                }
                if (options.ShowDescription)
                {
                    return(_commandFactory.CreateDescriptionCommand());
                }
                if (options.PerformDebug)
                {
                    return(_commandFactory.CreateDebugCommand());
                }

                return(_commandFactory.CreateBuildCommand());
            }

            return(new ErrorCommandDecorator(_commandFactory.CreateHelpCommand()));
        }
Example #2
0
        private ICommand CreateCommand(CakeOptions options)
        {
            if (options != null)
            {
                if (options.ShowHelp)
                {
                    return(_commandFactory.CreateHelpCommand());
                }

                if (options.ShowVersion)
                {
                    return(_commandFactory.CreateVersionCommand());
                }

                if (options.Script != null)
                {
                    if (options.PerformDryRun)
                    {
                        return(_commandFactory.CreateDryRunCommand());
                    }

                    if (options.ShowDescription)
                    {
                        _log.SetVerbosity(options.Verbosity);
                        return(_commandFactory.CreateDescriptionCommand());
                    }

                    return(_commandFactory.CreateBuildCommand());
                }
            }

            _console.WriteLine();
            _log.Error("Could not find a build script to execute.");
            _log.Error("Either the first argument must the build script's path,");
            _log.Error("or build script should follow default script name conventions.");

            return(new ErrorCommandDecorator(_commandFactory.CreateHelpCommand()));
        }
Example #3
0
 private ICommand CreateCommand(CakeOptions options)
 {
     if (options != null)
     {
         if (options.ShowHelp)
         {
             return(_commandFactory.CreateHelpCommand());
         }
         if (options.ShowVersion)
         {
             return(_commandFactory.CreateVersionCommand());
         }
         if (options.Script != null)
         {
             if (options.ShowDescription)
             {
                 _log.Verbosity = Verbosity.Quiet;
                 return(_commandFactory.CreateDescriptionCommand());
             }
             return(_commandFactory.CreateBuildCommand());
         }
     }
     return(_commandFactory.CreateHelpCommand());
 }