Skip to content

Commit

Permalink
Fix CliSettings.ResponseFileTokenReplacer and update to 2.0.0-beta4.2…
Browse files Browse the repository at this point in the history
…4324.3 of System.CommandLine

      - 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.
  • Loading branch information
calacayir committed Jul 19, 2024
1 parent 6b6fc61 commit 9eb794f
Show file tree
Hide file tree
Showing 227 changed files with 1,584 additions and 768 deletions.
515 changes: 319 additions & 196 deletions docs/README.md

Large diffs are not rendered by default.

Binary file modified images/intro.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/themes.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<!-- https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#generateassemblyinfo -->
<VersionPrefix>1.8.7</VersionPrefix>
<VersionPrefix>1.8.8</VersionPrefix>
<Product>DotMake Command-Line</Product>
<Company>DotMake</Company>
<!-- Copyright is also used for NuGet metadata -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace DotMake.CommandLine
/// </summary>
/// <example>
/// <inheritdoc cref="Cli" path="/example/code[@id='gettingStartedClass']" />
/// <code source="..\TestApp\Commands\WriteFileCommand.cs" region="WriteFileCommand" language="cs" />
/// <code source="..\TestApp\Commands\WriteFileCliCommand.cs" region="WriteFileCliCommand" language="cs" />
/// <code source="..\TestApp\Commands\ArgumentConverterCliCommand.cs" region="ArgumentConverterCliCommand" language="cs" />
/// <code source="..\TestApp\Commands\EnumerableCliCommand.cs" region="EnumerableCliCommand" language="cs" />
/// <code source="..\TestApp\Commands\RootSnakeSlashCliCommand.cs" region="RootSnakeSlashCliCommand" language="cs" />
Expand Down
11 changes: 10 additions & 1 deletion src/DotMake.CommandLine.Shared/Attributes/CliOptionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,23 @@ namespace DotMake.CommandLine
/// msbuild /version
/// ^------^
/// </code>
/// Both POSIX and Windows prefix conventions are supported. When you configure an option, you specify the option name including the prefix.
/// Both POSIX and Windows prefix conventions are supported.
/// When manually setting a name (overriding decorated property's name), you should specify the option name including the prefix (e.g. `--option`, `-o`, `-option` or `/option`).
/// </para>
/// <para>
/// Bundling of single-character options are supported, also known as stacking.
/// Bundled options are single-character option aliases specified together after a single hyphen prefix.
/// For example if you have options "-a", "-b" and "-c", you can bundle them like "-abc".
/// Only the last option can specify an argument.
/// Note that if you have an explicit option named "-abc" then it will win over bundled options.
/// </para>
/// </summary>
/// <example>
/// <inheritdoc cref="Cli" path="/example/code[@id='gettingStartedDelegate']" />
/// <inheritdoc cref="Cli" path="/example/code[@id='gettingStartedClass']" />
/// <code source="..\TestApp\Commands\RecursiveOptionCliCommand.cs" region="RecursiveOptionCliCommand" language="cs" />
/// <code source="..\TestApp\Commands\ParentCommandAccessorCliCommand.cs" region="ParentCommandAccessorCliCommand" language="cs" />
/// <code source="..\TestApp\Commands\OptionBundlingCliCommand.cs" region="OptionBundlingCliCommand" language="cs" />
/// </example>
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter)]
public class CliOptionAttribute : Attribute
Expand Down
3 changes: 3 additions & 0 deletions src/DotMake.CommandLine.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=4a98fdf6_002D7d98_002D4f5a_002Dafeb_002Dea44ad98c70c/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Instance" AccessRightKinds="Private" Description="Instance fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;Kind Name="READONLY_FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/UserRules/=f9fce829_002De6f4_002D4cb2_002D80f1_002D5497c44f51df/@EntryIndexedValue">&lt;Policy&gt;&lt;Descriptor Staticness="Static" AccessRightKinds="Private" Description="Static fields (private)"&gt;&lt;ElementKinds&gt;&lt;Kind Name="FIELD" /&gt;&lt;/ElementKinds&gt;&lt;/Descriptor&gt;&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;&lt;/Policy&gt;</s:String>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EPredefinedNamingRulesToUserRulesUpgrade/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
5 changes: 4 additions & 1 deletion src/DotMake.CommandLine/CliSettings.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.CommandLine;
using System.CommandLine.Parsing;
using System.IO;

Expand Down Expand Up @@ -77,7 +78,7 @@ public class CliSettings
/// When enabled, any token prefixed with <c>@</c> can be replaced with zero or more other tokens.
/// This is mostly commonly used to expand tokens from response files and interpolate them into a command line prior to parsing.
/// </remarks>
public TryReplaceToken ResponseFileTokenReplacer { get; set; }
public TryReplaceToken ResponseFileTokenReplacer { get; set; } = DefaultConfiguration.ResponseFileTokenReplacer;

/// <summary>
/// Gets or sets the standard output. Used by Help and other facilities that write non-error information.
Expand All @@ -100,5 +101,7 @@ public class CliSettings
/// <para>Default is <see cref="CliTheme.Default"/>.</para>
/// </summary>
public CliTheme Theme { get; set; } = CliTheme.Default;

private static readonly CliConfiguration DefaultConfiguration = new CliConfiguration(new CliRootCommand());
}
}
8 changes: 5 additions & 3 deletions src/DotMake.CommandLine/DotMake.CommandLine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
<Description>Declarative syntax for System.CommandLine via attributes for easy, fast, strongly-typed (no reflection) usage. Includes a source generator which automagically converts your classes to CLI commands and properties to CLI options or CLI arguments.</Description>
<PackageTags>command-line CLI console System.CommandLine declarative attributes parsing command argument option generator</PackageTags>
<PackageReleaseNotes>
- 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&lt;int&gt;).
- 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.
</PackageReleaseNotes>
</PropertyGroup>

Expand All @@ -34,7 +36,7 @@
as it's not on official nuget feed, we directly reference the DLL inside the package so that it's also bundled in our package.
https://blog.maartenballiauw.be/post/2020/04/22/referencing-specific-assembly-nuget-package.html
-->
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.24201.1">
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.24324.3">
<GeneratePathProperty>true</GeneratePathProperty>
<IncludeAssets>None</IncludeAssets>
<ExcludeAssets>All</ExcludeAssets>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

#if !NET5_0_OR_GREATER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

// Licensed to the .NET Foundation under one or more agreements.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.CasingConvention.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.External.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.External.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.PrefixConvention.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.CasingConvention.GeneratedCode
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <auto-generated />
// Generated by DotMake.CommandLine.SourceGeneration v1.8.7.0
// Roslyn (Microsoft.CodeAnalysis) v4.900.24.12101
// Generated by DotMake.CommandLine.SourceGeneration v1.8.8.0
// Roslyn (Microsoft.CodeAnalysis) v4.1000.24.32408
// Generation: 1

namespace TestApp.Commands.GeneratedCode
Expand Down
Loading

0 comments on commit 9eb794f

Please sign in to comment.