pitermarx/Cake.Console

Exclusive and a few other common Cake Arguments not supported

Closed this issue · 2 comments

Both Cake scripting and Frosting use Spectre.Console and now that Cake.CLI is used that dependency already exists in the project.
This would solve #3 too.

To align with Cake maybe Frosting's settings could be a good starting point
https://github.com/cake-build/cake/blob/b8c287aea1f084be96ffca9d82587e41e8a582da/src/Cake.Frosting/Internal/Commands/DefaultCommandSettings.cs#L13-L54

internal sealed class DefaultCommandSettings : CommandSettings
    {
        [CommandOption("--target|-t <TARGET>")]
        [DefaultValue("Default")]
        [Description("Target task to invoke.")]
        public string Target { get; set; }

        [CommandOption("--working|-w <PATH>")]
        [TypeConverter(typeof(Cli.DirectoryPathConverter))]
        [Description("Sets the working directory")]
        public DirectoryPath WorkingDirectory { get; set; }

        [CommandOption("--verbosity|-v <VERBOSITY>")]
        [Description("Specifies the amount of information to be displayed.\n(Quiet, Minimal, Normal, Verbose, Diagnostic)")]
        [TypeConverter(typeof(VerbosityConverter))]
        [DefaultValue(Verbosity.Normal)]
        public Verbosity Verbosity { get; set; }

        [CommandOption("--description|--descriptions|--showdescription|--showdescriptions")]
        [Description("Shows description for each task.")]
        public bool Description { get; set; }

        [CommandOption("--tree|--showtree")]
        [Description("Shows the task dependency tree.")]
        public bool Tree { get; set; }

        [CommandOption("--dryrun|--noop|--whatif")]
        [Description("Performs a dry run.")]
        public bool DryRun { get; set; }

        [CommandOption("--exclusive|-e")]
        [Description("Executes the target task without any dependencies.")]
        public bool Exclusive { get; set; }

        [CommandOption("--version|--ver")]
        [Description("Displays version information.")]
        public bool Version { get; set; }

        [CommandOption("--info")]
        [Description("Displays additional information about Cake.")]
        public bool Info { get; set; }
    }

Frosting's default command could be used as inspiration on how Spectre.Console parsed commands are passed to Frosting
https://github.com/cake-build/cake/blob/b8c287aea1f084be96ffca9d82587e41e8a582da/src/Cake.Frosting/Internal/Commands/DefaultCommand.cs#L30

And here how it's done in Cake scripting engine
https://github.com/cake-build/cake/blob/a1893a2bba26f49e089d66beeb78421cedf6126d/src/Cake/Infrastructure/ContainerConfigurator.cs#L28

@devlead I believe this is done now.
Can you check?

closing this. let me know if anything is missing