public SetupCommand(string cat, string cmd, string shortCmd, SetupCommandHandler handler) { Category = cat; Command = cmd; ShortCommand = shortCmd; Handler = handler; }
private async Task <Option <Unit, Error> > Setup() { var handler = new SetupCommandHandler( _configuration, _cloudStorageService); _logger.Write("Enter your root music folder (e.g. 'Music' (paths are still not accepted)): "); var rootCollectionFolder = _reader.ReadLine(); var result = await handler.ExecuteAsync(new SetupArguments { RootCollectionFolder = rootCollectionFolder }); return(await result.MapAsync(async _ => { _logger.WriteLine($"Successfully set '{rootCollectionFolder}' as your base collection folder!"); return Unit.Value; })); }
public void AddCommand(string category, string command, string shortName, string arguments, string description, string longDescription, SetupCommandHandler handler) { SetupCommand cmd = new SetupCommand(category, command, shortName, handler); cmd.Usage = arguments; cmd.Description = description; cmd.LongDescription = longDescription; bool foundCat = false; for (int n = 0; n < commands.Count; n++) { SetupCommand ec = (SetupCommand)commands [n]; if (ec.Category == category) { foundCat = true; } else if (foundCat) { commands.Insert(n, cmd); break; } } if (!foundCat) { commands.Add(cmd); } }
/// <summary> /// Adds a custom command to the add-in manager /// </summary> /// <param name="category"> /// Category under which the command has to be shown in the help text /// </param> /// <param name="command"> /// Name of the command /// </param> /// <param name="shortName"> /// Short name of the command (it's an alias of the normal name) /// </param> /// <param name="arguments"> /// Formal description of the arguments that the command accepts. For example: "[addin-id|addin-file] [--xml] [--all] [--full] [--namespace <namespace>]" /// </param> /// <param name="description"> /// Short description of the command /// </param> /// <param name="longDescription"> /// Long description of the command /// </param> /// <param name="handler"> /// Delegate to be invoked to run the command /// </param> public void AddCommand(string category, string command, string shortName, string arguments, string description, string longDescription, SetupCommandHandler handler) { SetupCommand cmd = new SetupCommand (category, command, shortName, handler); cmd.Usage = arguments; cmd.Description = description; cmd.LongDescription = longDescription; int lastCatPos = -1; for (int n=0; n<commands.Count; n++) { SetupCommand ec = (SetupCommand) commands [n]; if (ec.Category == category) lastCatPos = n; } if (lastCatPos == -1) commands.Add (cmd); else commands.Insert (lastCatPos+1, cmd); }
public void AddCommand(string category, string command, string shortName, string arguments, string description, string longDescription, SetupCommandHandler handler) { SetupCommand cmd = new SetupCommand(category, command, shortName, handler); cmd.Usage = arguments; cmd.Description = description; cmd.LongDescription = longDescription; int lastCatPos = -1; for (int n = 0; n < commands.Count; n++) { SetupCommand ec = (SetupCommand)commands [n]; if (ec.Category == category) { lastCatPos = n; } } if (lastCatPos == -1) { commands.Add(cmd); } else { commands.Insert(lastCatPos + 1, cmd); } }
public void AddCommand (string category, string command, string shortName, string arguments, string description, string longDescription, SetupCommandHandler handler) { SetupCommand cmd = new SetupCommand (category, command, shortName, handler); cmd.Usage = arguments; cmd.Description = description; cmd.LongDescription = longDescription; bool foundCat = false; for (int n=0; n<commands.Count; n++) { SetupCommand ec = (SetupCommand) commands [n]; if (ec.Category == category) foundCat = true; else if (foundCat) { commands.Insert (n, cmd); break; } } if (!foundCat) commands.Add (cmd); }