feat(dispatch): support --flag value in addition to --flag=value #2

Closed
opened 2026-05-19 12:08:44 +02:00 by michael · 0 comments
Owner

Problem

parse_args() in dispatch.lua only supports --flag=value syntax.
--flag value (space-separated) is not supported.

Example:
fragjan code . --pack=daw-code -- works
fragjan code . --pack daw-code -- pack = true, daw-code becomes positional

Current Implementation

local key, val = a:match("^%-%-([^=]+)=?(.*)$")
result.flags[key] = (val ~= "" and val or true)

Next arg is never consumed as value when val is empty.

Impact

Affects all programs using berhtjan-cli (fragjan, merkwerk, others).
Fix here benefits all consumers.

Solution

When val is empty and next arg does not start with --, consume
next arg as value.

DAW/fragjan#4

## Problem parse_args() in dispatch.lua only supports --flag=value syntax. --flag value (space-separated) is not supported. Example: fragjan code . --pack=daw-code -- works fragjan code . --pack daw-code -- pack = true, daw-code becomes positional ## Current Implementation ```lua local key, val = a:match("^%-%-([^=]+)=?(.*)$") result.flags[key] = (val ~= "" and val or true) ``` Next arg is never consumed as value when val is empty. ## Impact Affects all programs using berhtjan-cli (fragjan, merkwerk, others). Fix here benefits all consumers. ## Solution When val is empty and next arg does not start with --, consume next arg as value. ## Related DAW/fragjan#4
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/daw-modul-berhtjan-cli#2
No description provided.