Penguins-lab.Cargs 1.0.2

dotnet add package Penguins-lab.Cargs --version 1.0.2
NuGet\Install-Package Penguins-lab.Cargs -Version 1.0.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="Penguins-lab.Cargs" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Penguins-lab.Cargs --version 1.0.2
#r "nuget: Penguins-lab.Cargs, 1.0.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 Penguins-lab.Cargs as a Cake Addin
#addin nuget:?package=Penguins-lab.Cargs&version=1.0.2

// Install Penguins-lab.Cargs as a Cake Tool
#tool nuget:?package=Penguins-lab.Cargs&version=1.0.2

Cargs紹介ページ


Sample code ↓

using Cargs.Attributes;

namespace ConsoleApp1 {

    class Program {

        //短いswitch名と長いswitch名を指定できます。
        // /a
        // /prop1
        [PropSwitch( 'a', "prop1" )] 
        public bool HogeProp1 { get; set; }

        //長いswitch名だけでも
        // /prop2
        [PropSwitch( "prop2" )] 
        public bool HogeProp2 { get; set; }

        //もちろん短いswitch名だけでもOK
        // /p
        [PropSwitch( 'p' )] 
        public bool HogeProp3 { get; set; }

        // 文字列が欲しい場合
        // /prop4 hogehoge
        [PropSwitch( "prop4", Option = SwitchOptions.String )] 
        public string HogeProp4 { get; set; }

        //staticでも動作します。
        // /prop5
        [PropSwitch( "prop5" )] 
        public static bool HogeProp5 { get; set; }


        //こちらもPropertyと同じように指定できます
        // /b
        // /Method1
        [MethodSwitch( 'b', "Method1" )] 
        public void HogeMethod1() { }

        //引数を持つこともできます
        // /Method2 123 hoge
        [MethodSwitch( "Method2", SwitchOptions.Int, SwitchOptions.String )] 
        public void HogeMethod2( int i, string s) { }

        //もちろんstaticでも動作します。
        // /Method3
        [MethodSwitch( "Method3" )] 
        public static void HogeMethod3() { }

        static void Main(string[] args) {

            var ins = new Program();
            //引数の解析をします
            Cargs.Analyzer.Analyze( ins, args );

        }

    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.2 1,082 11/19/2017
1.0.1 1,058 11/19/2017
1.0.0 1,052 11/19/2017

PropAttributeのOption変更に対応