Skip to content
This repository has been archived by the owner on Jan 8, 2024. It is now read-only.

Backport of cli/main: Add -version flag for CLI version into release/0.2.x #1051

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions internal/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@ func Main(args []string) int {
// up plugin processes by calling Close on all the resources we use.
defer plugin.CleanupClients()

// NOTE: This is only for running `waypoint -v` and expecting it to return
// a version. Any other subcommand will expect `-v` to be around verbose
// logging rather than printing a version
if len(args) == 2 && args[1] == "-v" {
args[1] = "-version"
}

// Initialize our logger based on env vars
args, log, logOutput, err := logger(args)
if err != nil {
Expand Down Expand Up @@ -87,6 +94,7 @@ func Main(args []string) int {
cli := &cli.CLI{
Name: args[0],
Args: args[1:],
Version: vsn.FullVersionNumber(true),
Commands: commands,
Autocomplete: true,
AutocompleteNoDefaultFlags: true,
Expand Down