-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: File scoped namespaces and usings satements
- Loading branch information
Showing
7 changed files
with
222 additions
and
231 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,42 @@ | ||
using JetBrains.Annotations; | ||
using McMaster.Extensions.CommandLineUtils; | ||
|
||
namespace Moniker.Cli | ||
namespace Moniker.Cli; | ||
|
||
[Command(Name = "moniker", FullName = "moniker", Description = "Moniker command line interface")] | ||
[VersionOptionFromMember(MemberName = nameof(GetVersion))] | ||
internal class Program | ||
{ | ||
[Command(Name = "moniker", FullName = "moniker", Description = "Moniker command line interface")] | ||
[VersionOptionFromMember(MemberName = nameof(GetVersion))] | ||
internal class Program | ||
private readonly IConsole _console; | ||
|
||
public Program(IConsole console) => _console = console; | ||
|
||
[Option("-s|--style <STYLE>", | ||
"The style of moniker to generate (Moniker or Moby)", | ||
CommandOptionType.SingleValue)] | ||
[UsedImplicitly] | ||
public MonikerStyle MonikerStyle { get; } = MonikerStyle.Moniker; | ||
|
||
[Option("-d|--delimiter <DELIMITER>", | ||
"The delimiter to use between name parts such as adjective and noun", | ||
CommandOptionType.SingleValue)] | ||
[UsedImplicitly] | ||
public string Delimiter { get; } = NameGenerator.DefaultDelimiter; | ||
|
||
[UsedImplicitly] | ||
public int OnExecute() | ||
{ | ||
private readonly IConsole _console; | ||
|
||
public Program(IConsole console) => _console = console; | ||
|
||
[Option("-s|--style <STYLE>", | ||
"The style of moniker to generate (Moniker or Moby)", | ||
CommandOptionType.SingleValue)] | ||
[UsedImplicitly] | ||
public MonikerStyle MonikerStyle { get; } = MonikerStyle.Moniker; | ||
|
||
[Option("-d|--delimiter <DELIMITER>", | ||
"The delimiter to use between name parts such as adjective and noun", | ||
CommandOptionType.SingleValue)] | ||
[UsedImplicitly] | ||
public string Delimiter { get; } = NameGenerator.DefaultDelimiter; | ||
|
||
[UsedImplicitly] | ||
public int OnExecute() | ||
{ | ||
var moniker = NameGenerator.Generate(MonikerStyle, Delimiter); | ||
_console.WriteLine(moniker); | ||
return 0; | ||
} | ||
|
||
private static int Main(string[] args) | ||
=> CommandLineApplication.Execute<Program>(args); | ||
|
||
private static string? GetVersion() => | ||
(string?)typeof(Program).Assembly | ||
.GetType("GitVersionInformation")! | ||
.GetField("FullSemVer")! | ||
.GetValue(null); | ||
var moniker = NameGenerator.Generate(MonikerStyle, Delimiter); | ||
_console.WriteLine(moniker); | ||
return 0; | ||
} | ||
|
||
private static int Main(string[] args) | ||
=> CommandLineApplication.Execute<Program>(args); | ||
|
||
private static string? GetVersion() => | ||
(string?)typeof(Program).Assembly | ||
.GetType("GitVersionInformation")! | ||
.GetField("FullSemVer")! | ||
.GetValue(null); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
namespace Moniker | ||
namespace Moniker; | ||
|
||
/// <summary> | ||
/// Supported styles of random names to generate. | ||
/// </summary> | ||
public enum MonikerStyle | ||
{ | ||
/// <summary> | ||
/// Supported styles of random names to generate. | ||
/// Names found in the technosophos/moniker project. | ||
/// </summary> | ||
public enum MonikerStyle | ||
{ | ||
/// <summary> | ||
/// Names found in the technosophos/moniker project. | ||
/// </summary> | ||
Moniker, | ||
Moniker, | ||
|
||
/// <summary> | ||
/// Names found in the moby/moby project. | ||
/// </summary> | ||
Moby | ||
} | ||
/// <summary> | ||
/// Names found in the moby/moby project. | ||
/// </summary> | ||
Moby | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.