Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/parser/__tests__/parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,22 @@ describe("Parser", () => {
})
})

it("should parse option with value having \"=\" (equals) character, using equals notation", () => {
const line = "--opt=field=val"
const result = parseLine(line)
expect(result.options).toEqual({
opt: 'field=val'
})
})

it("should parse option with value having \"=\" (equals) character, using space notation", () => {
const line = "--opt field=val"
const result = parseLine(line)
expect(result.options).toEqual({
opt: 'field=val'
})
})

describe("should handle aliases", () => {
test("with simple options", () => {
const line = "--my-opt true --int 23456 --float=3.14159265 --on=on -t=my-type"
Expand Down
4 changes: 3 additions & 1 deletion src/parser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,9 @@ class OptionParser {
return false
}

const [name, rawval] = tree.current.split("=", 2)
const parts = tree.current.split("=")
const name = parts.shift() || ""
const rawval = parts.length ? parts.join("=") : undefined
const concatOpts = isConcatenatedOpt(name)

if (concatOpts) {
Expand Down