Skip to content

v3.2.0

Choose a tag to compare

@github-actions github-actions released this 20 Sep 19:52
20447b6

Summary

Adds an --interactive (-i) flag to the five create commands (zones,
users, groups, permission-templates, records). When set, any
required value not already supplied via flag or argument is prompted for
interactively, followed by a summary and confirmation before the resource
is actually created.

This is marked as a feature preview — the prompt flow may still change
based on feedback, and a notice is printed to stderr whenever --interactive
is used.

What's new

  • New internal/cmd/base/interactive.go helper package (PromptString,
    PromptSelect, PromptInt, PromptBool, PromptStringSlice,
    PrintPreviewNotice), built on
    charmbracelet/huh, reused across
    all five commands.
  • --interactive / -i flag added to:
    • zones create
    • users create (existing masked password prompt is unaffected)
    • groups create
    • permission-templates create
    • records create
  • Values already supplied via flag or positional argument are never
    re-prompted.
  • Conditional prompts where relevant (e.g. TTL for zones create only
    asked when nameservers are set; priority for records create only asked
    for MX/SRV).
  • Final summary + confirmation (base.Confirm) before the API call runs.
  • README updated with an "Interactive Mode" section and per-command
    examples; reference docs regenerated (go run ./scripts/docs.go).

Bug fix along the way

records create --interactive initially failed with a 404 zone not found when the zone name was supplied via the interactive prompt, because
base.ResolveZoneID reads --zone-name/--zone-id directly from Cobra's
flag set rather than from the local variable. Fixed by writing the
prompted value back with cmd.Flags().Set("zone-name", ...).

Testing

Manually verified for all five commands:

  • Prompts only appear for missing values, not for ones already set via
    flags/args.
  • Type flags (--type for zones/permission-templates, record type) are
    skipped when explicitly set.
  • Declining the final confirmation aborts without creating anything.
  • Non-interactive usage (no -i) is unchanged.

Not included

  • No automated tests yet for the new interactive code paths.
  • update commands don't support --interactive yet (could follow the
    same pattern later).