https://github.com/lexz-08/clihelper
Provides simpler management and checking of command-line arguments in an application.
https://github.com/lexz-08/clihelper
cli cli-tool command-line command-line-tool csharp windows
Last synced: 3 months ago
JSON representation
Provides simpler management and checking of command-line arguments in an application.
- Host: GitHub
- URL: https://github.com/lexz-08/clihelper
- Owner: Lexz-08
- Created: 2024-07-18T23:29:54.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-07-28T01:02:36.000Z (almost 2 years ago)
- Last Synced: 2025-06-28T19:51:38.465Z (about 1 year ago)
- Topics: cli, cli-tool, command-line, command-line-tool, csharp, windows
- Language: C#
- Homepage: https://github.com/Lexz-08/CLIHelper
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CLIHelper
## Description
Provides simpler management and checking of command-line arguments in an application.
## How To Use
```csharp
using CLIHelper;
internal class Program
{
private enum MySwitch
{
// random switches for example
b,
v,
x,
// as long as the argument matches the name, it will parse
debug
}
// attributes can be on any one method that is marked as just 'static'
[Argument("arg1", CLIType.String, 1)]
[Switch("arg12", typeof(MySwitch), SwitchIdentifier.Slash, 2)]
[OptionalArgument("arg3", CLIType.String)]
[OptionalSwitch("arg4", typeof(MySwitch), SwitchIdentifier.Hyphen)]
static void Main()
{
var args = CLI.GetArguments(); // will return null if any parsing errors occurred, which in turn will be printed to the console
if (args != null)
{
// and now do what you need with your arguments
Console.WriteLine(args["arg1"].ToString());
Console.WriteLine(args["arg2"].GetEnumValue());
}
}
}
```
## To-Do
- [ ] Check for entry method named `Main` to ensure clarity with attribute usage
- [X] Print out available arguments if none are provided
- [X] Make use of `Description` metadata in [`CLIAttribute`](https://github.com/Lexz-08/CLIHelper/blob/master/CLIHelper/Attributes.cs)
- [ ] Replace `_` in enum value names with `-` for complex switch arguments
## Example of Argument Layout (given insufficient arguments)

## Download
[CLIHelper.dll](https://github.com/Lexz-08/CLIHelper/releases/latest/download/CLIHelper.dll)