From f64651c8c6b8bf19e4feb99312827190f277a11c Mon Sep 17 00:00:00 2001 From: Chetan Sarva Date: Fri, 5 Nov 2021 15:17:56 -0400 Subject: [PATCH] cleanup: flags --- bin/vproxy/flags.go | 4 +++- bin/vproxy/main.go | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/vproxy/flags.go b/bin/vproxy/flags.go index 355b621..ff28f2f 100644 --- a/bin/vproxy/flags.go +++ b/bin/vproxy/flags.go @@ -200,6 +200,7 @@ vproxy connect hello.local:8888 -- vproxy hello { Name: "caroot", Usage: "Print CAROOT path and exit", + Hidden: hideFlags, Action: printCAROOT, Before: loadClientConfig, Flags: []cli.Flag{ @@ -244,6 +245,7 @@ vproxy connect hello.local:8888 -- vproxy hello { Name: "bash_completion", Usage: "Generate bash completion script", + Hidden: hideFlags, Action: genBashCompletion, Description: `To use bash completion, add the following to your .bashrc: @@ -277,7 +279,7 @@ or add a file to your bash_completion.d: // Hide flags unless verbose flag set func shouldHideFlags() bool { for _, f := range os.Args { - if f == "--verbose" || f == "-v" { + if f == "--verbose" || f == "-v" || f == "--generate-bash-completion" { return false } } diff --git a/bin/vproxy/main.go b/bin/vproxy/main.go index 6a479ee..a4d3a60 100644 --- a/bin/vproxy/main.go +++ b/bin/vproxy/main.go @@ -261,8 +261,7 @@ func printInfo(c *cli.Context) error { } func genBashCompletion(c *cli.Context) error { - comp := ` -#! /bin/bash + comp := `#! /bin/bash _cli_bash_autocomplete() { if [[ "${COMP_WORDS[0]}" != "source" ]]; then