A generic parser for slash command text input
0
fork

Configure Feed

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

feat: rename to slasher

+26 -61
+3 -7
README.md
··· 7 7 Basic Usage: 8 8 9 9 ```ts 10 - import parse from 'jsr:@inro/slash-command-parser' 10 + import parse from 'jsr:@bpev/slasher' 11 11 12 12 parse('/todos add name: My Todo Name') 13 13 ··· 22 22 Pass in a template to parse options: 23 23 24 24 ```ts 25 - import parse, { OptionDefinition, OptionType } from 'jsr:@inro/slash-command-parser' 25 + import parse, { OptionDefinition, OptionType } from 'jsr:@bpev/slasher' 26 26 27 27 const template: OptionDefinition[] = [ 28 28 { name: 'item', type: OptionType.string }, ··· 43 43 If you want greater control over parsing or error handling, you can call each step individually: 44 44 45 45 ```ts 46 - import { 47 - parseCommand, 48 - parseOptions, 49 - parseSubCommands, 50 - } from 'jsr:@inro/slash-command-parser' 46 + import { parseCommand, parseOptions, parseSubCommands } from 'jsr:@bpev/slasher' 51 47 52 48 const content = 'add item: lettuce howmany: 2 complete: false' 53 49
+4 -1
deno.json
··· 1 1 { 2 - "name": "@inro/slash-command-parser", 2 + "name": "@bpev/slasher", 3 3 "version": "0.0.2", 4 4 "exports": "./mod.ts", 5 5 "fmt": { ··· 9 9 }, 10 10 "tasks": { 11 11 "test": "deno fmt && deno check ./mod.ts && deno lint && deno test -A ./" 12 + }, 13 + "imports": { 14 + "@std/assert": "jsr:@std/assert@^1.0.19" 12 15 } 13 16 }
+18 -52
deno.lock
··· 1 1 { 2 - "version": "3", 3 - "packages": { 4 - "specifiers": { 5 - "jsr:@std/assert@^0.215.0": "jsr:@std/assert@0.215.0", 6 - "jsr:@std/fmt@^0.215.0": "jsr:@std/fmt@0.215.0", 7 - "jsr:@std/testing": "jsr:@std/testing@0.215.0" 2 + "version": "5", 3 + "specifiers": { 4 + "jsr:@std/assert@*": "1.0.19", 5 + "jsr:@std/assert@^1.0.19": "1.0.19", 6 + "jsr:@std/internal@^1.0.12": "1.0.13" 7 + }, 8 + "jsr": { 9 + "@std/assert@1.0.19": { 10 + "integrity": "eaada96ee120cb980bc47e040f82814d786fe8162ecc53c91d8df60b8755991e", 11 + "dependencies": [ 12 + "jsr:@std/internal" 13 + ] 8 14 }, 9 - "jsr": { 10 - "@std/assert@0.215.0": { 11 - "dependencies": [ 12 - "jsr:@std/fmt@^0.215.0" 13 - ] 14 - }, 15 - "@std/fmt@0.215.0": {}, 16 - "@std/testing@0.215.0": { 17 - "dependencies": [ 18 - "jsr:@std/assert@^0.215.0" 19 - ] 20 - } 15 + "@std/internal@1.0.13": { 16 + "integrity": "2f9546691d4ac2d32859c82dff284aaeac980ddeca38430d07941e7e288725c0" 21 17 } 22 18 }, 23 - "remote": { 24 - "https://jsr.io/@std/assert/0.215.0/_constants.ts": "a271e8ef5a573f1df8e822a6eb9d09df064ad66a4390f21b3e31f820a38e0975", 25 - "https://jsr.io/@std/assert/0.215.0/_diff.ts": "f8f568f6d3a36652deb4701303fe7a2a66bfec242682effe53211398e363c39e", 26 - "https://jsr.io/@std/assert/0.215.0/_format.ts": "0ba808961bf678437fb486b56405b6fefad2cf87b5809667c781ddee8c32aff4", 27 - "https://jsr.io/@std/assert/0.215.0/assert.ts": "501b416473ec27c71885aaf819e363c8df617f89ce68ae57fec7acf9d62743b2", 28 - "https://jsr.io/@std/assert/0.215.0/assert_almost_equals.ts": "77a20a203abff37146dc029afd14e7cce9c9c085c25a107a5f075ed49b646db0", 29 - "https://jsr.io/@std/assert/0.215.0/assert_array_includes.ts": "9f511b9b57d48f1ff643259192a66f855b8075a8fb9d9f3cdefc0e008cfe3466", 30 - "https://jsr.io/@std/assert/0.215.0/assert_equals.ts": "78139785a690be8e450ad13698287bfb5c50518833a6c4ccb96d6fe66dd9c573", 31 - "https://jsr.io/@std/assert/0.215.0/assert_exists.ts": "7ea6a5cbaf3ce2675adc863d11544ba0f0d6e61658c5f0a83b5aa999e48961f0", 32 - "https://jsr.io/@std/assert/0.215.0/assert_false.ts": "8941f89de0386609eb1749f334483d56420307997bbbba77a559c5fe7083a657", 33 - "https://jsr.io/@std/assert/0.215.0/assert_greater.ts": "441cfcab6ab8c06d6c54d5995d513a148c9ed7ec2d241c154e6a127b3f22f995", 34 - "https://jsr.io/@std/assert/0.215.0/assert_greater_or_equal.ts": "d841652741b8087235f3392abd6db387cc4ecfe91cbd9fbc721937789f325faa", 35 - "https://jsr.io/@std/assert/0.215.0/assert_instance_of.ts": "ab945d09a94ca382ac4e9044412a9414efe301ad0ae36b72c02159e7148321ed", 36 - "https://jsr.io/@std/assert/0.215.0/assert_is_error.ts": "823298a6a5bf5e51580932aadbb1cfb22a6945c502868dc9dca2a70bcf70062d", 37 - "https://jsr.io/@std/assert/0.215.0/assert_less.ts": "282d39e91ce16e33d5b8352771d97c81d840f1810ba7b65b64332eba5b0f0c50", 38 - "https://jsr.io/@std/assert/0.215.0/assert_less_or_equal.ts": "a68b8ae9fa056449b63c8d3fb771fe8a3747d958877096e85839b75f3c581576", 39 - "https://jsr.io/@std/assert/0.215.0/assert_match.ts": "7395d0d84346d9a81695559d11afe890137f1c469bb5cafb6aba1a7faaf142f8", 40 - "https://jsr.io/@std/assert/0.215.0/assert_not_equals.ts": "b08ac1034e4b9aedff0bad798df7880c8f977019a90e98a5e0e4f88c7dfa6353", 41 - "https://jsr.io/@std/assert/0.215.0/assert_not_instance_of.ts": "340861128c5a03071247fdc6011b8499fd277d9faeb14306a4af9cd642a302c3", 42 - "https://jsr.io/@std/assert/0.215.0/assert_not_match.ts": "f09d94377a6403800f7d8602a70bce27d3d6ff699cd95e141b43c35c3b0e798d", 43 - "https://jsr.io/@std/assert/0.215.0/assert_not_strict_equals.ts": "1028e690746157783c44cd0d17d88d17a57ece9d387a8cc8e15aef291ac98258", 44 - "https://jsr.io/@std/assert/0.215.0/assert_object_match.ts": "9f02fd409595a8b656ec9f436fe012932e3729a58e8292e7c4c5b9b50266da5f", 45 - "https://jsr.io/@std/assert/0.215.0/assert_rejects.ts": "af2d87faafdf44a3af69fd9e8952d5a07707d2b6b8c413f46ec3b90227539b3a", 46 - "https://jsr.io/@std/assert/0.215.0/assert_strict_equals.ts": "72d7b15c9cf128cd4fbb29fb794e1a2bc612b55935de035f17127587f8411e75", 47 - "https://jsr.io/@std/assert/0.215.0/assert_string_includes.ts": "c178bd97da03e2215494e729b2048ae68e780bf0b583a998a3bf808fbdb1eba2", 48 - "https://jsr.io/@std/assert/0.215.0/assert_throws.ts": "4209628c4fa3e569bb2924b289fad486f9e5feb0912bca6f60b484ddbfad7136", 49 - "https://jsr.io/@std/assert/0.215.0/assertion_error.ts": "dd027fb33707dbff22cd2ef9b55fdb70e2095876caf3c68ecfbb811505ecc022", 50 - "https://jsr.io/@std/assert/0.215.0/equal.ts": "166d9377ce8df4d53f676d9a568a13914c2323d9d3b2fd1096aafeb59f3c1edf", 51 - "https://jsr.io/@std/assert/0.215.0/fail.ts": "67579a1308b176d52756ded6d1e3149f87703648e59afc333ba5168fefeb8d7b", 52 - "https://jsr.io/@std/assert/0.215.0/mod.ts": "325df8c0683ad83a873b9691aa66b812d6275fc9fec0b2d180ac68a2c5efed3b", 53 - "https://jsr.io/@std/assert/0.215.0/unimplemented.ts": "ed3115f6fb271277e0522f3b18f020259900c385e3fa986f109a519a1cf25763", 54 - "https://jsr.io/@std/assert/0.215.0/unreachable.ts": "1e748f69f73c57f4de9ba1dba39306b86e0ad2c0915975608519a2bcf42c262f", 55 - "https://jsr.io/@std/fmt/0.215.0/colors.ts": "59b5de7c07cdc0322ed61b2d98da1ca4fbc9f576d45c2beee577a27556e52d63", 56 - "https://jsr.io/@std/testing/0.215.0/asserts.ts": "5cd80412824d40539c0ca984ab3ce9db090604b9a7085418b4ee7cc6ba193711" 19 + "workspace": { 20 + "dependencies": [ 21 + "jsr:@std/assert@^1.0.19" 22 + ] 57 23 } 58 24 }
+1 -1
mod.test.ts
··· 1 - import { assertEquals, assertThrows } from 'jsr:@std/testing/asserts' 1 + import { assertEquals, assertThrows } from '@std/assert' 2 2 import parse, { isCommand, OptionType, parseCommand } from './mod.ts' 3 3 4 4 Deno.test('isCommand == true', () => {