vmware-archive/fly

Proposal: Default target when `--target` not specified

Closed this issue · 2 comments

Motivation

I use fly, rarely across multiple environments at the same time but its nice to have the option. I would like to have my fly pointed to a default environment, so I don't have to set --target each time on the cli.

Take this proposed workflow.

$ fly login -c my-concourse.com -u me -p secret

Target 'default' saved.

I didn't specify a target flag so I was assigned the 'default' target. (open to more clever names than default)

Running any of the fly commands without the --target flag should run against my 'default' environment.

$ fly targets could show you the default environment settings, along with still showing available targets.

Figured a proposal would be best before any PR's 😋

@robtec : The design should also allow updating default targets too.
Could consider supporting --default flag on the login command to set any target as default. More elegant way to update defaults.

Any update on getting a default target?

Here is the scenario:

# login to a target
fly -t first-target login

# now, every fly after it doesn't need to point to target
fly pipelines
fly builds

# switch to another target
fly -t another-target login

# then fly again
fly pipelines
fly builds

# proposal for new options to `targets` command
# add `--default` option to set the default target then
fly targets --default first-target

A default target would be very handy if I want to have a make target to fly pipelines, and I don't want to specify a specific target inside my Makefile.

This makes the fly cli more similar to other clis like kubectl, gcloud, etc.