Skip to content

Commit

Permalink
fix(core): fix wrong behavior when use oneArg together with long arg
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Jan 14, 2020
1 parent f592c6c commit 71a0174
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/koishi-core/src/app.ts
Expand Up @@ -8,6 +8,7 @@ import { showSuggestions } from './utils'
import { Meta, MessageMeta } from './meta'
import { simplify, noop } from 'koishi-utils'
import { errors, messages } from './messages'
import { ParsedLine } from './parser'

export interface AppOptions {
port?: number
Expand Down Expand Up @@ -290,7 +291,9 @@ export class App extends Context {
let _message = message.slice(name.length)
if (fuzzy && !nickname && _message.match(/^\S/)) continue
if (oneArg) _message = `'${_message.trim()}'`
const result = command.parse(_message)
const result: ParsedLine = oneArg
? { rest: '', options: {}, unknown: [], args: [_message.trim()] }
: command.parse(_message)
result.options = { ...options, ...result.options }
result.args.unshift(...args)
parsedArgv = { meta, command, ...result }
Expand Down

0 comments on commit 71a0174

Please sign in to comment.