A generic parser for slash command text input
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

docs: update readme

+3 -9
+3 -9
README.md
··· 10 10 import parse from 'https://deno.land/x/slash_command_parser/mod.ts' 11 11 12 12 parse('/todos add name: My Todo Name') 13 - ``` 14 13 15 - ```ts 16 14 { 17 15 text: 'add name: My Todo Name', 18 16 command: 'todos', ··· 24 22 Pass in a template to parse options: 25 23 26 24 ```ts 27 - import parse, { 28 - OptionDefinition, 29 - OptionType, 30 - } from 'https://deno.land/x/slash_command_parser/mod.ts' 25 + import parse, { OptionDefinition, OptionType } from 'slash_command_parser' 31 26 32 27 const template: OptionDefinition[] = [ 33 28 { name: 'item', type: OptionType.string }, ··· 36 31 ] 37 32 38 33 parse('/todos add item: lettuce howmany: 2 complete: false', template) 39 - ``` 40 34 41 - ```ts 42 35 { 43 36 text: 'add item: lettuce howmany: 2 complete: false', 44 37 command: 'todos', ··· 54 47 parseCommand, 55 48 parseOptions, 56 49 parseSubCommands, 57 - } from 'https://deno.land/x/slash_command_parser/mod.ts' 50 + } from 'slash_command_parser' 58 51 59 52 const content = 'add item: lettuce howmany: 2 complete: false' 60 53 61 54 // Just parsing command + text can give you a "Slack"-style slashcommand 55 + // Also useful if you want to use a custom subCommand or options parser 62 56 const { command, text } = parseCommand(content) 63 57 64 58 // Expand to support 4 sub-commands instead of 2