MSPro.CLArgs
1.2112.2
See the version list below for details.
dotnet add package MSPro.CLArgs --version 1.2112.2
NuGet\Install-Package MSPro.CLArgs -Version 1.2112.2
<PackageReference Include="MSPro.CLArgs" Version="1.2112.2" />
paket add MSPro.CLArgs --version 1.2112.2
#r "nuget: MSPro.CLArgs, 1.2112.2"
// Install MSPro.CLArgs as a Cake Addin #addin nuget:?package=MSPro.CLArgs&version=1.2112.2 // Install MSPro.CLArgs as a Cake Tool #tool nuget:?package=MSPro.CLArgs&version=1.2112.2
MSPro CLArgs Version History
2021-12-11 - December 2021 Release
- Support for .net 6.0
- Allow empty string as argument
2021-09-07 - September 2021 Release
- Fixes
- Improved help output
- Support for ? and /? as a single parameter to get help
- Improved error messages
- Fixed samples
- Improved CLArgs parser
2021-05-04 - Mai 2021 Beta Release
- Improved support for "help" and "?" tags.
2021-04-26 - Mai 2021 Alpha Release
The CommandLineParser
was completely rewritten, to be more flexible. It now supports blanks to split option values from names, like --mixed-option is-set
. In addition, quote handling is now more standard. In addition, option tags are now string instead of character, only, to support option tags.
- Fixed a bug in Option Names not respecting
Setting.IgnoreCase
- Introduced Unit Testing
Compatibility changes
The '
character is no longer supported in the command-line to mark a string. Always use "
instead.
DEPLOY /Package="Sprint 03" --dst-env 01-DEV /dn:"Fixed API" " Another target"
Settings.cs
char[] OptionsTags --> string[] OptionsTags
char[] OptionValueTags --> string[] OptionValueTags
2021-04-12
I have started and migrated some old project, called CleanFolders to use CLArgs
. This project serves as a real world example, that demonstrates how to use CLArgs
in most cases. Check it out here CleanSolution CLArgs application.
While migrating this project, I recognized some limitations, which I have fixed immediately:
Targets can now be used in a
CommandContext
.Previously, Targets were available in
CommandLineArguments
, only. This made it very inconvenient to use Targets withCommander.ExecuteCommand
: Now you can specify a property in your CommandContext that will receive the targets specified in the command-line.class CommandContext { [Targets] public List<string> Directories { get; set; } = new(); ... }
(See again the CleanSolution example for using Targets)
BETA Support for
OptionTagValue
' ' to allow blanks as option-value separator, like/p "Parameter value" /x 5
instead of/p:"Parameter value" /x:5
. Basically, this works; BETA because I haven't extensively tested all scenarios.Improved
Settings
to support help-text output for different consoles width':HelpAlignColumn
andHelpFullWidth
properties.Provides files ('@' token) are now found in the current (working) directory and then in the application's (exe) directory. This is extremely useful when you want to create Profiles.
Self-Contained Assemblies
- NO support for automatic Command resolution (
AssemblyCommandResolver
) with self-contained Assemblies, yet.
Self-Contained .net Assemblies are special, in a way, that there is an EXE, only. However, this EXE that you see in a directory is <u>not</u> an Assembly - it is a PE File!
This PE-File contains all Assemblies of your solution. Once you run such PE-Exe-File,
Assembly.GetEntryAssembly()
returns the entry Assembly, which is a DLL with the name of the EXE. So far, so good, for all commands in the entry Assembly.To resolve Commands in other Assemblies, normally
Directory.GetFiles( ppDomain.CurrentDomain.BaseDirectory( pattern)
does the job. For self-contained applications, this call won't return and more Assembly, as all other Assemblies have become part of the EXE.I haven't found any way yet, to Load Assemblies when they are 'baked-into' a self-contained executable.
To work around this, you can provide your own Assembly resolver instead of AssemblyCommandResolver
, to find all your command implementations:
Commander.ExecuteCommand(args, new Settings
{
CommandResolver = new AssemblyCommandResolver(assemblyFileNames),
...
Don't forget to tell me, once you have written such resolver for PE-Files!
Command-Line Profiles
A Profile is a collection of predefined command-line arguments. You can store such profiles as global profiles in the Application (EXE) directory or you can override these global profiles by providing a local profiles in the current working directory.
If you store your application together with its global profiles, for example, here
%LocalAppdata%\MSPro\Programs
(don't forget to set a path to it), you can run CleanSolution.Exe @sln.profile
from any working directory and apply the settings from the global profile stored with the application.
2021-04-09
Released to make some updates available to the public. CLArgs
is mainly used in my personal project on a daily basis. This project and the daily use of it, gives new ideas, servers as the best proof of concept you can have and it helps me to find and fix issues.
Changes since last version in January
- Fixed bug with @ file handling
- Introduced AllowMultiple functionality (see CleanSolution CLArgs application to see how it is used)
- Refactored to use .net5.0 and C# 9.0
- Support for .net 5.0
- Help output pretty much improved
- Support for '|' character in help-text to enforce line-breaks. (see CleanSolution CLArgs application to see how it is used)
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- JetBrains.Annotations (>= 2021.3.0)
-
.NETFramework 4.8
- JetBrains.Annotations (>= 2021.3.0)
-
.NETStandard 2.0
- JetBrains.Annotations (>= 2021.3.0)
-
.NETStandard 2.1
- JetBrains.Annotations (>= 2021.3.0)
-
net5.0
- JetBrains.Annotations (>= 2021.3.0)
-
net6.0
- JetBrains.Annotations (>= 2021.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.2312.16 | 206 | 12/16/2023 |
2.2208.2 | 488 | 8/24/2022 |
1.2112.2 | 328 | 12/11/2021 |
1.2109.7 | 328 | 9/7/2021 |
1.2104.12.1 | 323 | 4/12/2021 |
1.2104.9.1 | 347 | 4/10/2021 |
1.2012.29.1 | 363 | 12/29/2020 |
1.2009.8.1 | 432 | 9/8/2020 |
1.2008.5.2 | 485 | 8/5/2020 |