static void Main(string[] args) { // Cmdr: A CommandLine Arguments Parser Cmdr.NewWorker(RootCmd.New( new AppInfo { AppName = "mdx-tool", }, (root) => { root.AddCommand(new Command { Short = "lkp", Long = "lookup", Description = "dictionary lookup tool", TailArgs = "<Mdx Files (*.mdx;*.mdd)> <word-pattern>", Action = (lookupAction) }); root.AddCommand(new Command { Short = "ls", Long = "list", Description = "list a dictionary entries and dump for debugging", TailArgs = "<Mdx Files (*.mdx;*.mdd)>", Action = (listAction) }); root.AddCommand(new Command { Short = "t", Long = "tags", Description = "tags operations" } .AddCommand(new TagsAddCmd()) .AddCommand(new TagsRemoveCmd()) // .AddCommand(new TagsAddCmd { }) // dup-test .AddCommand(new TagsListCmd()) .AddCommand(new TagsModifyCmd()) ); }), // <- RootCmd // Options -> (w) => { w.SetLogger(SerilogBuilder.Build((logger) => { logger.EnableCmdrLogInfo = false; logger.EnableCmdrLogTrace = false; })); // w.EnableDuplicatedCharThrows = true; }) .Run(args); // HzNS.MdxLib.Core.Open("*.mdx,mdd,sdx,wav,png,...") => mdxfile // mdxfile.Preload() // mdxfile.GetEntry("beta") => entryInfo.{item,index} // mdxfile.Find("a") // "a", "a*b", "*b" // mdxfile.Close() // mdxfile.Find() // mdxfile.Find() // mdxfile.Find() // Log.CloseAndFlush(); // Console.ReadKey(); }
protected void TriggerSubCommand(CmdTrigger <C> trigger) { var subAlias = trigger.Text.NextWord(); SubCommand subCmd; if (m_subCommands.TryGetValue(subAlias, out subCmd)) { if (RootCmd.MayTrigger(trigger, subCmd, false)) { subCmd.Process(trigger); } } else { trigger.Reply("SubCommand not found: " + subAlias); trigger.Text.Skip(trigger.Text.Length); mgr.DisplayCmd(trigger, this, false, false); } }
protected void TriggerSubCommand(CmdTrigger <C> trigger) { string key = trigger.Text.NextWord(); SubCommand subCommand; if (m_subCommands.TryGetValue(key, out subCommand)) { if (!RootCmd.MayTrigger(trigger, subCommand, false)) { return; } subCommand.Process(trigger); } else { trigger.Reply("SubCommand not found: " + key); trigger.Text.Skip(trigger.Text.Length); mgr.DisplayCmd(trigger, this, false, false); } }