makes "store-api-ey" a command
This commit is contained in:
@ -46,7 +46,6 @@ namespace isn
|
|||||||
|
|
||||||
static readonly OptionSet pushoptions = new OptionSet {
|
static readonly OptionSet pushoptions = new OptionSet {
|
||||||
{ "k|api-key=", "use api key", val => apiKey = apiKey ?? val },
|
{ "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 },
|
{ "s|source=", "use source", val => CurrentSource = CurrentSource ?? val },
|
||||||
{ "h|help", "show this message and exit", h => shouldShowPushHelp = h != null },
|
{ "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)
|
Run = sargs => StoreApiKey(sargs)
|
||||||
};
|
};
|
||||||
|
@ -9,14 +9,18 @@ namespace isn
|
|||||||
|
|
||||||
partial class Program
|
partial class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
private static void StoreApiKey(IEnumerable<string> storeArgs)
|
private static void StoreApiKey(IEnumerable<string> storeArgs)
|
||||||
{
|
{
|
||||||
var args = storeoptions.Parse(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)
|
if (shouldShowPushHelp)
|
||||||
{
|
{
|
||||||
// output the options
|
// output the options
|
||||||
Console.Error.WriteLine("Push Options:");
|
Console.Error.WriteLine("StoreApiKey Options:");
|
||||||
storeoptions.WriteOptionDescriptions(Console.Out);
|
storeoptions.WriteOptionDescriptions(Console.Out);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user