ArdaOzcan.SimpleArgParse 1.0.4

.NET Standard 2.0
Install-Package ArdaOzcan.SimpleArgParse -Version 1.0.4
dotnet add package ArdaOzcan.SimpleArgParse --version 1.0.4
<PackageReference Include="ArdaOzcan.SimpleArgParse" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArdaOzcan.SimpleArgParse --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ArdaOzcan.SimpleArgParse, 1.0.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ArdaOzcan.SimpleArgParse as a Cake Addin
#addin nuget:?package=ArdaOzcan.SimpleArgParse&version=1.0.4

// Install ArdaOzcan.SimpleArgParse as a Cake Tool
#tool nuget:?package=ArdaOzcan.SimpleArgParse&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Welcome to the SimpleArgParse wiki!

SimpleArgParse Wiki

Welcome to SAP Wiki! Navigate through the sections to learn how to use SAP.

Quick Start

Positional Arguments

You can use positional arguments if an argument is required and has to be provided in a certain position.

If you pass in a name for the argument that does not start with the prefix "-", it will be parsed as a positional argument.

Example:

using System;
using ArdaOzcan.SimpleArgParse;

namespace Wiki
{
    class Program
    {
        static void Main(string[] args)
        {
            var parser = new ArgumentParser();
            parser.AddArgument("name");
            parser.AddArgument("surname");
            var parsedArgs = parser.ParseArgs(args);
            Console.WriteLine(parsedArgs);
        }
    }
}
> wiki.exe -h
usage: wiki [-h] name surname

Optional arguments:
  -h, --help            Show this message.

Positional arguments:
  name
  surname
> wiki.exe arda özcan
Namespace([name, arda], [surname, özcan])

Positional arguments are mandatory.

> wiki.exe
usage: wiki [-h] name
wiki : error: the following arguments are required: name

You can access positional variables just like a dictionary since Namespace derives from Dictionary<string, object>.

Example:

using System;
using ArdaOzcan.SimpleArgParse;

namespace Wiki
{
    class Program
    {
        static void Main(string[] args)
        {
            var parser = new ArgumentParser();
            parser.AddArgument("name");
            parser.AddArgument("surname");
            var parsedArgs = parser.ParseArgs(args);
            Console.WriteLine(parsedArgs["name"]);
        }
    }
}
> wiki.exe arda özcan
arda

Optional Arguments

If you start an argument name with "-" prefix, it will be an optional argument. Only Store action will be referenced here in the Quick Start section. Check the ArgumentAction section for more detailed information.

Example:

using System;
using ArdaOzcan.SimpleArgParse;

namespace Wiki
{
    class Program
    {
        static void Main(string[] args)
        {
            var parser = new ArgumentParser();
            parser.AddArgument("-n", "--name");
            var parsedArgs = parser.ParseArgs(args);
            Console.WriteLine(parsedArgs);
        }
    }
}
> wiki.exe -n arda
Namespace([name, arda])

As the name implies these arguments are optional, so optional arguments' values are null by default.

> wiki.exe
Namespace([name, ])
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
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.4 384 9/13/2020
1.0.3 224 8/27/2020
1.0.2 218 8/27/2020
1.0.1 246 8/26/2020
1.0.0 266 8/23/2020