From 481567138ff234fe67b4b4addf047c27c159b45b Mon Sep 17 00:00:00 2001 From: Kevin Froman Date: Sat, 19 Dec 2020 19:01:40 -0600 Subject: [PATCH] added cli project --- rinseoffcli/RinseOffCLI.cs | 46 ++++++++++++++++++++++++++++++++++ rinseoffcli/rinseoffcli.csproj | 8 ++++++ 2 files changed, 54 insertions(+) create mode 100644 rinseoffcli/RinseOffCLI.cs create mode 100644 rinseoffcli/rinseoffcli.csproj diff --git a/rinseoffcli/RinseOffCLI.cs b/rinseoffcli/RinseOffCLI.cs new file mode 100644 index 0000000..b1841e1 --- /dev/null +++ b/rinseoffcli/RinseOffCLI.cs @@ -0,0 +1,46 @@ +using System; +using System.IO; +namespace rinseoffcli +{ + class Program + { + + static void showHelp(int exitCode = 1){ + Console.WriteLine("Must specify store or load, then a file name followed by a key file.\nFormat: "); + System.Environment.Exit(exitCode); + } + static void storeData(string filepath, string keypath){ + Stream inputStream = Console.OpenStandardInput(); + if (! File.Exists(keypath)){ + Console.WriteLine("Key file " + keypath + " does not exist"); + System.Environment.Exit(3); + } + + } + static void Main(string[] args) + { + if (args.Length == 0){ + showHelp(); + } + var cmd = args[0].ToLower(); + switch(cmd){ + case "store": + if (args.Length != 3){ + Console.WriteLine("Invalid number of arguments"); + showHelp(2); + } + storeData(args[1], args[2]); + break; + default: + Console.WriteLine("Invalid command"); + showHelp(); + break; + case "help": + case "--help": + case "-h": + showHelp(); + break; + } + } + } +} diff --git a/rinseoffcli/rinseoffcli.csproj b/rinseoffcli/rinseoffcli.csproj new file mode 100644 index 0000000..c73e0d1 --- /dev/null +++ b/rinseoffcli/rinseoffcli.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + +