Skip to content

Commit

Permalink
Merge pull request #2 from nRafinia/main
Browse files Browse the repository at this point in the history
  • Loading branch information
nRafinia authored Mar 26, 2023
2 parents a3187c2 + b61036b commit c5f13f4
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public Base64Command(IBase64Service base64Service, IOutputProvider outputProvide
_base64Service = base64Service;
_outputProvider = outputProvider;
_decodeText = new Option<bool>(name: "--decode", description: "Decode Base64 text");
_decodeText.AddAlias("-d");
_textArgument = new Argument<string>("text", "text for encode/decode Base64");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public HtmlCommand(IHtmlService htmlService, IOutputProvider outputProvider)
_htmlService = htmlService;
_outputProvider = outputProvider;
_decodeText = new Option<bool>(name: "--decode", description: "Decode html-encoded text");
_decodeText.AddAlias("-d");
_textArgument = new Argument<string>("text", "text for html encode/decode");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public UrlCommand(IUrlService urlService, IOutputProvider outputProvider)
_urlService = urlService;
_outputProvider = outputProvider;
_decodeText = new Option<bool>(name: "--decode", description: "Decode url-encoded text");
_decodeText.AddAlias("-d");
_textArgument = new Argument<string>("text", "text for url encode/decode");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ public CalcCommand(IFileProvider fileProvider, IHashCalcService hashService, IOu
_outputProvider = outputProvider;
_textArgument = new Argument<string>("text", () => string.Empty, "Text for calculate fingerprint");
_fileName = new Option<string>(name: "--file", description: "File name for calculate hash");
_fileName.AddAlias("-f");
_lowerCase = new Option<bool>(name: "--lower", description: "Generate lower case");
_hashType = new Option<HashType>(name: "--type", () => HashType.All, "Hash type (MD5, SHA-1, SHA-256,...)");
_hashType.AddAlias("-t");
}

private Command GetFeatureCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,14 @@ public ChecksumCommand(IFileProvider fileProvider, IChecksumService hashService,
_outputProvider = outputProvider;
_textArgument = new Argument<string>("text", () => string.Empty, "Text for calculate fingerprint");
_fileName = new Option<string>(name: "--file", description: "File name for calculate hash");
_fileName.AddAlias("-f");
_lowerCase = new Option<bool>(name: "--lower", description: "Generate lower case");
_hashType = new Option<ChecksumType>(name: "--type", () => ChecksumType.All,
"Hash type (MD5, SHA-1, CRC-8, CRC-32, Adler-32,...)");
_hashType.AddAlias("-t");
_verify = new Option<string>(name: "--verify",
description: "Use the checksum type provided to verify your checksum");
_verify.AddAlias("-v");
}

private Command GetFeatureCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public PasswordCommand(IOutputProvider outputProvider, IPasswordService password
_customChar = new Option<string>(name: "--custom", () => string.Empty,
description: "Custom characters. If select the custom character other options was removed");
_length = new Option<int>(name: "--length", () => 16, description: "Password length");
_length.AddAlias("-l");
_prefix = new Option<string>(name: "--prefix", () => string.Empty, description: "Prefix");
_suffix = new Option<string>(name: "--suffix", () => string.Empty, description: "Suffix");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public JsonCommand(IFileProvider fileProvider, IJsonService jsonService, IOutput
_textArgument = new Argument<string>("text", () => string.Empty, "JSON text for processing");
_printType = new Option<JsonPrintType>("--print", "Print pretty/Compact JSON representation");
_fileName = new Option<string>(name: "--file", description: "File name for read JSON from that");
_fileName.AddAlias("-f");
_conversion =
new Option<ConversionType>(name: "--convert", description: "Convert JSON to other format (YAML, XML)");
_conversion.AddAlias("-c");
}

private Command GetFeatureCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public XmlCommand(IFileProvider fileProvider, IXmlService xmlService, IOutputPro
_outputProvider = outputProvider;
_textArgument = new Argument<string>("text", () => string.Empty, "XML text for processing");
_fileName = new Option<string>(name: "--file", description: "File name for read XML from that");
_fileName.AddAlias("-f");
_conversion =
new Option<ConversionType>(name: "--convert", description: "Convert XML to other format (JSON, YAML)");
_conversion.AddAlias("-c");
}

private Command GetFeatureCommand()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ public YamlCommand(IFileProvider fileProvider, IYamlService yamlService, IOutput
_outputProvider = outputProvider;
_textArgument = new Argument<string>("text", () => string.Empty, "YAML text for processing");
_fileName = new Option<string>(name: "--file", description: "File name for read YAML from that");
_fileName.AddAlias("-f");
_conversion =
new Option<ConversionType>(name: "--convert", description: "Convert YAML to other format (JSON, XML)");
_conversion.AddAlias("-c");
}

private Command GetFeatureCommand()
Expand Down
15 changes: 10 additions & 5 deletions src/nHash.Console/CommandLines/Uuids/UuidCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ public class UuidCommand : IUuidCommand
{
public Command Command => GetCommand();

private readonly Option<bool> _withBracket = new(name: "--bracket", description: "Generate with brackets");
private readonly Option<bool> _withoutHyphen = new(name: "--no-hyphen", description: "Generate without hyphens");

private readonly Option<UuidVersion> _version = new(name: "--version", () => UuidVersion.All,
description: "Select UUID version");
private readonly Option<bool> _withBracket;
private readonly Option<bool> _withoutHyphen;
private readonly Option<UuidVersion> _version;

private readonly Dictionary<UuidVersion, string> _uuidLabels = new()
{
Expand All @@ -29,6 +27,13 @@ public UuidCommand(IOutputProvider outputProvider, IUuidService uuidService)
{
_outputProvider = outputProvider;
_uuidService = uuidService;

_withBracket = new Option<bool>(name: "--bracket", description: "Generate with brackets");
_withoutHyphen = new Option<bool>(name: "--no-hyphen", description: "Generate without hyphens");
_version = new Option<UuidVersion>(name: "--version", () => UuidVersion.All,
description: "Select UUID version");

_version.AddAlias("-v");
}

private Command GetCommand()
Expand Down
1 change: 1 addition & 0 deletions src/nHash.Console/Initialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public static async Task<int> InitializeCommandLine(IEnumerable<string> args, IS
}

var outputFileName = new Option<string>(name: "--" + OutputOption, description: "File name for writing output");
outputFileName.AddAlias("-o");
rootCommand.AddGlobalOption(outputFileName);

var commandLineBuilder = new CommandLineBuilder(rootCommand)
Expand Down

0 comments on commit c5f13f4

Please sign in to comment.