Skip to content

Form names containing -> require shell quoting in extract mode #1

Description

@harold

Bug

When using cljdx extract with a form name that contains ->, the shell interprets > as a stdout redirect, silently sending output to a file instead of stdout.

Example

# Broken — shell interprets -> as redirect; cljdx receives "date-str-" as the form name
# and stdout goes to a file named "nice-date-str"
cljdx extract src/pf/webapp/util.cljs date-str->nice-date-str

# error: no form with id 'date-str-'

# Fixed — quoting prevents shell expansion
cljdx extract src/pf/webapp/util.cljs 'date-str->nice-date-str'

Impact

The failure mode is confusing: the error message says the form doesn't exist (because cljdx only receives the truncated date-str-), when in fact the form is present and correctly indexed. The cljdx index subcommand is unaffected since it only takes a filename argument.

Suggestion

  • Document the quoting requirement in --help output and/or the README, e.g. "Form names containing -> or ! should be single-quoted to prevent shell interpretation."
  • Optionally, detect when the supplied form id looks like a truncated symbol (no match but a match exists with a -> prefix) and emit a hint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions