WuGanhao.CommandLineParser
1.0.0-rc.2
This is a prerelease version of WuGanhao.CommandLineParser.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package WuGanhao.CommandLineParser --version 1.0.0-rc.2
NuGet\Install-Package WuGanhao.CommandLineParser -Version 1.0.0-rc.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WuGanhao.CommandLineParser" Version="1.0.0-rc.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WuGanhao.CommandLineParser --version 1.0.0-rc.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: WuGanhao.CommandLineParser, 1.0.0-rc.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WuGanhao.CommandLineParser as a Cake Addin #addin nuget:?package=WuGanhao.CommandLineParser&version=1.0.0-rc.2&prerelease // Install WuGanhao.CommandLineParser as a Cake Tool #tool nuget:?package=WuGanhao.CommandLineParser&version=1.0.0-rc.2&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
WuGanhao.CommandLineParser
This package provides a command line parser with following features:
- Supports sub commands, argument switch / options
- Strong typed arguments
Translation
Installation
You can refereces this package from nuget.org
with id WuGanhao.CommandLineParser
Sample
By using following sample code
using System;
using System.ComponentModel;
using System.Threading.Tasks;
using WuGanhao.CommandLineParser;
using WuGanhao.CSharpRewrite.SubCommands;
namespace WuGanhao.CSharpRewrite {
/// <remarks>RemoveTrailSpaces is a sub command implemented WuGanhao.CommandLineParser.SubCommand. You will need to implement your business inside RemoveTrailSpaces.Run()</remarks>
[SubCommand(typeof(RemoveTrailingSpaces), "remove-trailing-spaces", "Remove trailing spaces")]
[Description("A tool for help rewrite C# code")]
public class CommandExecutor {
[CommandOption("dir", "d", "Directory for start code processing")]
public string Directory { get; set; }
[CommandOption("pattern", "p", "Search file pattern")]
public string Pattern { get; set; }
[CommandOption("exclude-directories", "e", "Directories excluded for processing, Seperated by comma")]
public string ExcludeDirectories { get; set; } = "packages;obj;bin";
[CommandSwitch("interactive", "i", "Allow command interaction")]
public bool Interactive { get; set; }
}
public class Program {
static async Task<int> Main(string[] args) {
CommandLineParser<CommandExecutor> CmdLineParser = new CommandLineParser<CommandExecutor>();
try {
await CmdLineParser.Invoke();
return 0;
} catch (Exception ex) {
System.Console.WriteLine(ex);
return -1;
}
}
}
}
You can expect your command line runs like following
C:>cs-rewrite -h
cs-rewrite
A tool for help rewrite C# code
Usage:
cs-rewrite <command> [options]
Commands:
remove-trailing-spaces:
Remove trailing spaces
Options:
--dir | -d:
Directory for start code processing
--pattern | -p:
Search file pattern
--exclude-directories | -e:
Directories excluded for processing, Seperated by comma
--interactive | -i:
Allow command interaction
--help | -h
Print this help message and exit.
Try cs-rewrite <command> --help for command specific help.
This library is currently used in
- GitHub.CommandLine - A simple utility for managing with GitHub
- cs-rewrite - A tool for help rewrite C# code
Bugs and feature request
For bugs and feature requests. Please log it in GitHub Issues. Contributing a PR will be better.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
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 |
---|---|---|
1.0.1 | 244 | 10/13/2023 |
1.0.0 | 352 | 11/2/2022 |
1.0.0-rc.2 | 367 | 11/2/2022 |
0.3.0 | 723 | 9/11/2020 |
0.1.0 | 418 | 8/18/2020 |