mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-08 02:14:37 +00:00
fix(cron): allow clearing an existing workdir on edit
`updateJob` only emitted `--workdir <path>` when the value was non-empty, so once a workdir was set on a job, the user had no way to remove it through Scarf — clearing the TextField and saving was a silent no-op. Hermes' `cron edit --workdir` argparse documents passing an empty string as the explicit clear gesture (mirroring the existing `--script` shape, which already passes empty through here). Drop the `!isEmpty` predicate so a non-nil value — including "" — reaches the CLI. The previous capability gate keeps this safe on pre-v0.12 hosts: CronView passes `workdir: nil` there, so the flag is omitted and v0.11 argparse is never asked about an unknown arg. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -161,7 +161,10 @@ final class CronViewModel {
|
||||
for skill in newSkills where !skill.isEmpty { args += ["--skill", skill] }
|
||||
}
|
||||
if let script { args += ["--script", script] }
|
||||
if let workdir, !workdir.isEmpty { args += ["--workdir", workdir] }
|
||||
// `nil` = caller didn't touch the field (omit the flag). Empty string
|
||||
// = user cleared an existing workdir; Hermes documents `--workdir ""`
|
||||
// on edit as the explicit clear gesture, mirroring the `--script` shape.
|
||||
if let workdir { args += ["--workdir", workdir] }
|
||||
runAndReload(args, success: "Updated")
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user