public ListCommand(ConfigOption configOption, IServiceProvider serviceProvider, ILogger <ListCommand> logger) : base("list", "List artifacts") { AddArgument(new Argument <string>("nameSpace", "Namespace to list")); Handler = CommandHandler.Create(async(string nameSpace, CancellationToken token) => { if (!configOption.IsValid(logger)) { return(1); } await serviceProvider.GetRequiredService <ListActivity>().List(nameSpace, token); return(0); }); }
public DeleteCommand(ConfigOption configOption, IServiceProvider serviceProvider, ILogger <DeleteCommand> logger) : base("delete", "Delete artifact") { AddArgument(new Argument <string>("id", "ID to delete")); Handler = CommandHandler.Create(async(string id, CancellationToken token) => { if (!configOption.IsValid(logger)) { return(1); } await serviceProvider.GetRequiredService <DeleteActivity>().Delete(id, token); return(0); }); }
public GetCommand(ConfigOption configOption, IServiceProvider serviceProvider, ILogger <GetCommand> logger) : base("get", "Get artifact") { AddArgument(new Argument <string>("id", "ID to get")); AddArgument(new Argument <string>("file", "File to write to")); Handler = CommandHandler.Create(async(string id, string file, CancellationToken token) => { if (!configOption.IsValid(logger)) { return(1); } await serviceProvider.GetRequiredService <GetActivity>().Get(id, file, token); return(0); }); }