@rhizogrip/spore-cli 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/tui/commands.js +5 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhizogrip/spore-cli",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "author": {
5
5
  "name": "Christophe Le Bars",
6
6
  "email": "clb@toort.net"
@@ -50,7 +50,7 @@
50
50
  "tui": "node bin/spore.js tui"
51
51
  },
52
52
  "dependencies": {
53
- "@rhizogrip/spore": "1.1.0",
53
+ "@rhizogrip/spore": "1.3.0",
54
54
  "chalk": "^6.0.1",
55
55
  "minimist": "^1.2.8"
56
56
  },
package/tui/commands.js CHANGED
@@ -13,10 +13,13 @@ export const COMMANDS = [
13
13
  { name: 'quit', description: 'leave (Ctrl+D)' }
14
14
  ]
15
15
 
16
- /** `/name args…` as `{ name, args }`; null for a message — `//…` being one that starts with `/`. */
16
+ /**
17
+ * `/name args…` as `{ name, args }`; null for a message — `//…` being one that starts with `/`,
18
+ * and a path such as a dropped file's, whose first word is no command name.
19
+ */
17
20
  export function parseCommand (text) {
18
21
  const trimmed = text.trim()
19
22
  if (!trimmed.startsWith('/') || trimmed.startsWith('//')) return null
20
23
  const [name, ...args] = trimmed.slice(1).split(/\s+/)
21
- return name ? { name: name.toLowerCase(), args } : null
24
+ return /^[a-z][a-z-]*$/i.test(name) ? { name: name.toLowerCase(), args } : null
22
25
  }