From 9363cd756b8dadefad81d589734daff5b31a1418 Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Mon, 17 Apr 2023 19:04:59 +0100 Subject: [PATCH] makes "store-api-ey" a command --- src/isn/Program.cs | 3 +-- src/isn/commands/set-api-key.cs | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/isn/Program.cs b/src/isn/Program.cs index 8a543a6..70b0d8a 100644 --- a/src/isn/Program.cs +++ b/src/isn/Program.cs @@ -46,7 +46,6 @@ namespace isn static readonly OptionSet pushoptions = new OptionSet { { "k|api-key=", "use api key", val => apiKey = apiKey ?? val }, - { "p|store-api-key", "store used api key", val => storApiKey = val != null }, { "s|source=", "use source", val => CurrentSource = CurrentSource ?? val }, { "h|help", "show this message and exit", h => shouldShowPushHelp = h != null }, }; @@ -179,7 +178,7 @@ namespace isn } }; - var setapikey = new Command("set-api-key") + var setapikey = new Command("store-api-key", "Store this API key") { Run = sargs => StoreApiKey(sargs) }; diff --git a/src/isn/commands/set-api-key.cs b/src/isn/commands/set-api-key.cs index 7b2f018..7aecbf2 100644 --- a/src/isn/commands/set-api-key.cs +++ b/src/isn/commands/set-api-key.cs @@ -9,14 +9,18 @@ namespace isn partial class Program { - private static void StoreApiKey(IEnumerable storeArgs) { var args = storeoptions.Parse(storeArgs); + if (args.Count != 1) + { + Console.Error.WriteLine("StoreApiKey command takse one and only one argument, the key."); + shouldShowPushHelp=true; + } if (shouldShowPushHelp) { // output the options - Console.Error.WriteLine("Push Options:"); + Console.Error.WriteLine("StoreApiKey Options:"); storeoptions.WriteOptionDescriptions(Console.Out); } else