MediatR extensions for System.CommandLine.Hosting
Associate a command with either a notification or a request (only supports an integer return value). Please note that option and argument names must match constructor parameter names on your requests/notifications.
varroot=newRootCommand{newCommand("demo"){newCommand("since"){newArgument<TimeSpan>("since"){Arity=ArgumentArity.ExactlyOne}}.Publish<TimeSpanNotification>(),newCommand("guid"){newOption<Guid>("--userguid"){IsRequired=true}}.Send<GuidRequest>(),newCommand("names"){newArgument<IEnumerable<string>>("names"){Arity=ArgumentArity.OneOrMore}}.Publish<StringCollectionNotification>(),newCommand("ids"){newArgument<IEnumerable<int>>("ids"){Arity=ArgumentArity.OneOrMore}}.Publish<IntegerCollectionNotification>(),}};root.AddGlobalOption(newOption<bool>("--force","Force the job to run"));root.AddGlobalOption(newOption<bool>("--dry-run","Dry run"));