rackspace / rack

A CLI for Rackspace (unmaintained)
Other
81 stars 57 forks source link

Output stored profile information when proper credentials not specified #179

Open rtgoodwin opened 9 years ago

rtgoodwin commented 9 years ago

If the user misspells a profile, or omits entering one (and we aren't using a default profile logic), I think the help text could also list out the stored profiles as a reminder (alongside the other hint text about env vars, etc.). Or, open to alternate ideas about ways to hint at these.

kenperkins commented 9 years ago

Possible example:

/data/src/rack [upload-dir]* $ rack servers instance list --profile foo
error   Invalid config file profile: foo

Valid Profiles:
Default
test
production
/data/src/rack [upload-dir]* $
rtgoodwin commented 8 years ago

So, this addresses the user knowing to use the --profile flag, but for users that have just finished rack configure (or used it some time ago), it is pretty easy to forget about --profile, and nothing about --profile flag is shown in the error when no credentials at all or provided. (Or in the base help output.) It's possible I'm missing something very basic about outputting all of the available flags, but right now my rack help output is simply:

3:37 $ rack --h
NAME:
   rack - Command-line interface to manage Rackspace Cloud resources
USAGE:
   rack <command> <subcommand> <action> [FLAGS]

VERSION:
   rack version 1.1.0-beta1
   commit: 7e73c5fa6e420edf901cf7ca217ffeaed8744b1a

COMMANDS:
   configure        Interactively create a config file for Rackspace authentication.
   init         Enable tab for command completion.
            For Linux and OS X, creates the `rack` man page and sets up
            command completion for the Bash shell. Run `man ./rack.1` to
            view the generated man page.
            For Windows, creates a `posh_autocomplete.ps1` file in the
            `$HOME/.rack` directory. You must run the file to set up
            command completion.
   version      Print the version of this binary.
   servers      Operations on cloud servers, both virtual and bare metal.
   files        Object storage for files and media.
   networks     Software-defined networking.
   block-storage    Block-level storage, exposed as volumes to mount to
            host servers. Work with volumes and their associated snapshots.
   orchestration    Use a template language to orchestrate Rackspace cloud services.
   help, h      Shows a list of commands or help for one command

and the current help output when no credentials specified:

13:37 $ rack servers instance list
error   There are some required Rackspace Cloud credentials that we couldn't find.
    Here's what we have:
    auth-url: https://identity.api.rackspacecloud.com/v2.0/ (from default value)

    and here's what we're missing:
    api-key
    username

    You can set any of these credentials in the following ways:
    - Run `rack configure` to interactively create a configuration file,
    - Specify it in the command as a flag (--username, --api-key), or
    - Export it as an environment variable (RS_USERNAME, RS_API_KEY).

I feel like we should be a bit more proactive about showing them the profiles they've defined (if any).