Skip to content

fix(apikey): point missing-key hint at interactive 'civo apikey save' - #617

Merged
fulviodenza merged 1 commit into
masterfrom
fix/apikey-save-hint
Nov 10, 2026
Merged

fulviodenza merged 1 commit into
masterfrom
fix/apikey-save-hint

Conversation

@fulviodenza

Copy link
Copy Markdown
Contributor

Problem

Reported by a new user: running any command without an API key prints

Please go to https://dashboard.civo.com/security to obtain your API key, then save it using the command 'civo apikey save YOUR_API_KEY'.

Following that advice fails with There are too few arguments for this command, because the non-interactive form is civo apikey save NAME APIKEY. Passing the key on the command line also leaves it in shell history.

Change

  • config/config.go: the missing-key hint now recommends civo apikey save with no arguments, which prompts for a name and reads the key without echo.
  • cmd/apikey/apikey_save.go: the one-argument error now explains both valid forms (interactive, or NAME APIKEY).

Testing

Built locally and ran against an empty config:

$ civo kubernetes ls
Error: Creating the connection to Civo's API failed because no API key is supplied. ... then save it by running 'civo apikey save', which will prompt for a name and the key without echoing it to your terminal or shell history.

$ civo apikey save abc
Info: There are too few arguments for this command. Run 'civo apikey save' with no arguments to be prompted for a name and API key, or pass both as 'civo apikey save NAME APIKEY'

The no-API-key error told users to run 'civo apikey save YOUR_API_KEY',
which fails with 'too few arguments' because the non-interactive form
needs both NAME and APIKEY. Recommend the interactive form instead, which
also keeps the key out of shell history, and make the one-argument error
explain both valid forms.
@fulviodenza
fulviodenza merged commit c5aee5a into master Nov 10, 2026
3 checks passed
@fulviodenza
fulviodenza deleted the fix/apikey-save-hint branch November 10, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants