Skip to content

Commit

Permalink
Add usage examples in help
Browse files Browse the repository at this point in the history
  • Loading branch information
mnieto committed Jun 7, 2020
1 parent 7358593 commit 7e68ce7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ConfigSectionCrypt/Options.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using CommandLine;
using CommandLine.Text;

public class Options {
[Option('e', "encrypt", SetName = "encrypt", HelpText = "Encrypt the enumerated sections", Required = true)]
Expand All @@ -20,5 +21,22 @@ public class Options {
[Option('l', "loglevel", HelpText = "Logging level: Quiet, Normal, Verbose", Default = Verbosity.Normal)]
public Verbosity LogLevel { get; set; }

[Usage()]
public static IEnumerable<Example> Usage {
get {
yield return new Example("Encrypt multiple sections", new Options {
Encrypt = true,
ConfigFile = "MyApp.exe.config",
Section = "configurationStrings,SharedFolders".Split(','),
Include = @"c:\Path\To\Custom\DLL\SharedFolders.dll".Split(',')
});
yield return new Example("Decript connectionStrings section", new Options {
Decrypt = true,
ConfigFile = "MyApp.exe.config",
Section = "configurationStrings".Split(',')
});
}
}

internal char Operation { get; set; }
}

0 comments on commit 7e68ce7

Please sign in to comment.