Releases: dotmake-build/command-line
DotMake.CommandLine v2.0.0
- Updated to latest daily build 2.0.0-beta5.25174.1 of System.CommandLine.
 - Fixed: On Unix-like platforms, Console.ForegroundColor and Console.BackgroundColor is unset/unknown so prevent setting them to
ConsoleColor.Gray and ConsoleColor.Black on non-Windows platforms when theme color is null (unset).
Also will try to fix color visibility by making some assumptions (e.g. on OSX background color is white)
as it's impossible to detect terminal colors. - Added: NO_COLOR support, i.e. if 
NO_COLORenvironment variable is set, the colors will be disabled. - Improved: Added CustomizeLayout method in CliHelpBuilder to mimic the base class HelpBuilder in System.Commandline.
A delegate can be passed to customize the default layout sections in help output. - Fixed: System.CommandLine.RootCommand returned by Cli.GetConfiguration should have correct parents. This did not
effect the working of Cli, however for metadata purpose we will populate accurate command hierarchy even if
Cli.GetConfiguration is called for a command which is in the middle of the hierarchy. 
DotMake.CommandLine v1.9.0
- Updated to latest daily build 2.0.0-beta4.25072.1 of System.CommandLine.
 - Fixed: New naming convention of classes from System.CommandLine (they dropped 
Cliprefix from symbol classes and replaced it withCommandLinefor other classes). - Changed: Nuget framework targets from 
net7.0;netstandard2.0tonet8.0;netstandard2.0as underlying System.CommandLine package did so.
net7.0project can still usenetstandard2.0target. - Added: We now include a MSBuild .props file in the nuget package so referencing projects
that do not explicitly set SatelliteResourceLanguages property, will be considered using "en" by default:
Prevent satellite resource DLL pollution (which come from System.CommandLine package) in bin folder,
by setting a specific culture in referencing project, if not already set.
Empty value (default) for SatelliteResourceLanguages property causes copying of all culture subfolders and DLLs to bin folder,
so we opt for "en" culture by default, to prevent copying of satellite resource DLLs. - Fixed: Referencing DotMake.CommandLine DLL instead of project in DotMake.CommandLine.SourceGeneration.Embedded project,
does not work well, especially if you Clean and Build (or for first build) you get reference errors
as DotMake.CommandLine.dll is not yet produced, so better to use project reference but only from this project (to avoid circular dependency).
Ensure that the .Embedded project is built after DotMake.CommandLine project only for checking compile errors,
otherwise .cs files are only embedded as resource in DotMake.CommandLine.SourceGeneration.dll. 
DotMake.CommandLine v1.8.8
- Updated to latest daily build 2.0.0-beta4.24324.3 of System.CommandLine.
 - Fixed: CliSettings.ResponseFileTokenReplacer should use the default StringExtensions.TryReadResponseFile from System.CommandLine
so that response files should work out of the box. - Updated docs regarding bundled options, directives and response files features.
 
DotMake.CommandLine v1.8.7
- Updated to latest daily build 2.0.0-beta4.24201.1 of System.CommandLine.
 - Added support for command handlers or command as delegates without the async keyword (which returns Task or Task<int>).
 
DotMake.CommandLine v1.8.6
- Added parent command accessor support. Sub-commands can get a reference to the parent command by adding a property of the parent command type.
 - ParseResultExtensions.Bind improvement: Binding will be done only once per definition class, so calling this method consecutively for
the same definition class will return the cached result. 
// Sub-commands can get a reference to the parent command by adding a property of the parent command type.
[CliCommand(Description = "A root cli command with children that can access parent commands")]
public class ParentCommandAccessorCliCommand
{
    [CliOption(
        Description = "This is a global option (Recursive option on the root command), it can appear anywhere on the command line",
        Recursive = true)]
    public string GlobalOption1 { get; set; } = "DefaultForGlobalOption1";
    [CliArgument(Description = "Description for RootArgument1")]
    public string RootArgument1 { get; set; }
    public void Run(CliContext context)
    {
        context.ShowValues();
    }
    [CliCommand(Description = "A nested level 1 sub-command which accesses the root command")]
    public class Level1SubCliCommand
    {
        [CliOption(
            Description = "This is global for all sub commands (it can appear anywhere after the level-1 verb)",
            Recursive = true)]
        public string Level1RecursiveOption1 { get; set; } = "DefaultForLevel1RecusiveOption1";
        [CliArgument(Description = "Description for Argument1")]
        public string Argument1 { get; set; }
        // The parent command gets automatically injected
        public ParentCommandAccessorCliCommand RootCommand { get; set; }
        public void Run(CliContext context)
        {
            context.ShowValues();
        }
        [CliCommand(Description = "A nested level 2 sub-command which accesses its parent commands")]
        public class Level2SubCliCommand
        {
            [CliOption(Description = "Description for Option1")]
            public string Option1 { get; set; } = "DefaultForOption1";
            [CliArgument(Description = "Description for Argument1")]
            public string Argument1 { get; set; }
            // All ancestor commands gets injected
            public ParentCommandAccessorCliCommand RootCommand { get; set; }
            public Level1SubCliCommand ParentCommand { get; set; }
            public void Run(CliContext context)
            {
                context.ShowValues();
                Console.WriteLine();
                Console.WriteLine(@$"Level1RecursiveOption1 = {ParentCommand.Level1RecursiveOption1}");
                Console.WriteLine(@$"parent Argument1 = {ParentCommand.Argument1}");
                Console.WriteLine(@$"GlobalOption1 = {RootCommand.GlobalOption1}");
                Console.WriteLine(@$"RootArgument1 = {RootCommand.RootArgument1}");
            }
        }
    }
}DotMake.CommandLine v1.8.5
DotMake.CommandLine v1.8.4
- 
Updated to latest daily build
2.0.0-beta4.24126.1of System.CommandLine. - 
Fixed compiler error related to CliServiceProviderExtensions and CliServiceCollectionExtensions when project is referenced
by another project. Class conflict errors occur due to same namespace in different assemblies.This can't be fixed via PrivateAssets in PackageReference because although default value is "contentfiles;analyzers;build",
source generator still flows to the parent project via ProjectReference and PrivateAssets="all" prevents flow of
source generator but it also prevents flow of "compile" so it becomes useless.First attempt to fix (in v1.8.3), was making CliServiceProviderExtensions and CliServiceCollectionExtensions
classes internal but the problem resurfaces if user adds InternalsVisibleTo attribute in child project.So we finally solve this problem, by detecting if current compilation is a parent project in the solution,
if so we do not inject feature extensions as they already come transitively from the child project.
This way we can also keep CliServiceProviderExtensions and CliServiceCollectionExtensions classes public. 
DotMake.CommandLine v1.8.3
- Fixed "CS0436 : The type 'CliServiceProviderExtensions' in ..." compiler error when project is referenced by another project.
 - Generated Builder classes will be put in 
GeneratedCodesub-namespace of the definition class's namespace to prevent namespace pollution.
GlobalGeneratedCodenamespace was already being used by delegate-model, now class-based model will useGeneratedCodesub-namespace. 
DotMake.CommandLine v1.8.2
- Updated to latest daily build 
2.0.0-beta4.24123.1of System.CommandLine. - Better error messages when a passed class does not have a 
[CliCommand]attribute or it's a nested class and one of its parents
does not have a[CliCommand]attribute. - On Windows platform, backslash + double quote (
\") at the end of an argument,
is usually a path separator and not an escape for double quote, so it will be trimmed to prevent unnecessary path errors.
Related to dotnet/command-line-api#2334, dotnet/command-line-api#2276, dotnet/command-line-api#354 
DotMake.CommandLine v1.8.1
- 
Added support for other dependency injection containers (e.g. Autofac) when
onlyMicrosoft.Extensions.DependencyInjection.Abstractionspackage (version >= 2.1.1) is added to the project.
You can set your custom service provider with the extension methodCli.Ext.SetServiceProvider.
In previous version, this method already existed but accepted aServiceProviderparameter, instead of
IServiceProviderparameter which allows 3rd party implementations other than the default one inMicrosoft.Extensions.DependencyInjection.using DotMake.CommandLine; using Autofac.Core; using Autofac.Core.Registration; var cb = new ContainerBuilder(); cb.RegisterType<object>(); var container = cb.Build(); Cli.Ext.SetServiceProvider(container); Cli.Run<RootCliCommand>();
 - 
Reduced minimum version requirement for
Microsoft.Extensions.DependencyInjectionfrom6.0.0to2.1.1
so that you don't need to update it in legacy projects. AddedCli.Ext.GetServiceCollectionand
Cli.Ext.GetServiceProviderOrDefaultextension methods. 
