Skip to content

create: plugin options never reach parse_plugin_options (key prefix mismatch) #7

@ultimatile

Description

@ultimatile

Summary

CreateCommand.parse_plugin_options extracts plugin options by looking for keys that start with "--" in the parsed-args dict. However, ArgParse stores option destinations without the -- prefix (e.g. --git becomes "git"), so the function silently never matches and jtc create --<plugin> ... plugin options are dropped before they reach PackageGenerator.

This is a pre-existing bug surfaced during Copilot review of #6 — the prefix mismatch was there before that PR, not introduced by it.

Reproduction (illustrative)

function parse_plugin_options(args::Dict)::Dict{String, Dict{String, Any}}
    plugin_options = Dict{String, Dict{String, Any}}()
    for (key, values) in args
        # ArgParse-produced key looks like "git", not "--git"
        if startswith(String(key), "--") && values isa Vector
            ...
        end
    end
    return plugin_options   # always empty in practice
end

Plugin enables/options coming from real CLI parses are therefore ignored on create. Config-file-based plugin defaults still work because they are nested Dicts with capitalized plugin names and consumed via a different code path.

Suggested fixes

  • Update parse_plugin_options to look for the dest keys ArgParse actually produces (e.g. lowercase plugin names), and handle:
    • Bool (store_true) → enable plugin with no options
    • Vector (append_arg with nargs='*') → existing KEY=VALUE parsing
  • Or set an explicit :dest for these options that retains the "--plugin" shape.

Out of scope

This is logically related to #5 (CLI plugin option input forms), but is the create-side counterpart: even if input parsing is fixed, this consumer-side mismatch needs to be addressed for plugin options to take effect via CLI.

Source pointers

  • src/create_command.jl parse_plugin_options
  • src/cli.jl add_dynamic_plugin_options!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions