Skip to content

[BUG] hapi vps public-keys attach does not expose the required --ids flag #29

@coygeek

Description

@coygeek

Bug Description

hapi vps public-keys attach <virtual machine ID> appears to require a list of public key IDs, but the generated command does not expose an --ids flag on the attach subcommand.

The --ids flag appears under hapi vps public-keys create --help instead, even though public-key creation should only require --name and --key.

This makes the attach workflow hard to use from scripts and agentic tooling, because the command help does not expose the required machine-readable input.

Steps to Reproduce

  1. Clone https://github.com/hostinger/api-cli.
  2. Run:
go run . vps public-keys attach --help
  1. Run:
go run . vps public-keys create --help

Expected Behavior

hapi vps public-keys attach --help should show the required --ids flag:

hapi vps public-keys attach <virtual machine ID> --ids <public-key-id>

hapi vps public-keys create --help should only show creation fields such as --name and --key.

Actual Behavior

attach --help shows no --ids flag:

Usage:
  hapi vps public-keys attach <virtual machine ID> [flags]

Flags:
  -h, --help   help for attach

create --help shows --ids, where it does not belong:

Usage:
  hapi vps public-keys create [flags]

Flags:
      --ids stringArray   Public key ID list
      --key string        Public key content
      --name string       Public key name

Likely Cause

In cmd/vps/public_keys/attach.go, the attach command appears to register the flag on CreateCmd instead of AttachCmd:

CreateCmd.Flags().StringArrayP("ids", "", []string{}, "Public key ID list")
CreateCmd.MarkFlagRequired("ids")

Additional Context

This is especially noticeable for automation and agentic workflows that rely on CLI help, shell completion, and stable flags to discover and compose commands safely.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions