From 6c4f6076ea3f7a1581761fc0678725da0aa047ca Mon Sep 17 00:00:00 2001 From: Engin Diri Date: Sat, 20 Aug 2022 13:02:09 +0200 Subject: [PATCH] feat: Rework fig autocomplete command Signed-off-by: Engin Diri --- cmd/cosign/cli/commands.go | 2 ++ cmd/fig/fig.go | 27 --------------------------- go.mod | 2 +- go.sum | 4 ++-- 4 files changed, 5 insertions(+), 30 deletions(-) delete mode 100644 cmd/fig/fig.go diff --git a/cmd/cosign/cli/commands.go b/cmd/cosign/cli/commands.go index 963924b27f7..b41ee0e91a7 100644 --- a/cmd/cosign/cli/commands.go +++ b/cmd/cosign/cli/commands.go @@ -26,6 +26,7 @@ import ( cranecmd "github.com/google/go-containerregistry/cmd/crane/cmd" "github.com/sigstore/cosign/cmd/cosign/cli/options" + cobracompletefig "github.com/withfig/autocomplete-tools/integrations/cobra" ) var ( @@ -118,6 +119,7 @@ func New() *cobra.Command { cmd.AddCommand(cranecmd.NewCmdAuthLogin("cosign")) cmd.SetGlobalNormalizationFunc(normalizeCertificateFlags) + cmd.AddCommand(cobracompletefig.CreateCompletionSpecCommand()) return cmd } diff --git a/cmd/fig/fig.go b/cmd/fig/fig.go deleted file mode 100644 index cc5eead4f15..00000000000 --- a/cmd/fig/fig.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 The Sigstore Authors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package main - -import ( - "fmt" - - "github.com/sigstore/cosign/cmd/cosign/cli" - genFigSpec "github.com/withfig/autocomplete-tools/packages/cobra" -) - -func main() { - spec := genFigSpec.MakeFigSpec(cli.New()) - fmt.Println(spec.ToTypescript()) -} diff --git a/go.mod b/go.mod index 2729740a987..65211bf7e92 100644 --- a/go.mod +++ b/go.mod @@ -33,7 +33,7 @@ require ( github.com/stretchr/testify v1.8.0 github.com/theupdateframework/go-tuf v0.3.1 github.com/transparency-dev/merkle v0.0.1 - github.com/withfig/autocomplete-tools/packages/cobra v0.0.0-20220122124547-31d3821a6898 + github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 github.com/xanzy/go-gitlab v0.72.0 golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa golang.org/x/oauth2 v0.0.0-20220722155238-128564f6959c diff --git a/go.sum b/go.sum index 54587504b38..033c8bec1c9 100644 --- a/go.sum +++ b/go.sum @@ -1977,8 +1977,8 @@ github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvC github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= github.com/willf/bitset v1.1.11-0.20200630133818-d5bec3311243/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.11/go.mod h1:83CECat5yLh5zVOf4P1ErAgKA5UDvKtgyUABdr3+MjI= -github.com/withfig/autocomplete-tools/packages/cobra v0.0.0-20220122124547-31d3821a6898 h1:2Z+iziYPiyWk5hVJ3EYLn/i33Tj5ukytaJA0Th9tbgc= -github.com/withfig/autocomplete-tools/packages/cobra v0.0.0-20220122124547-31d3821a6898/go.mod h1:cKObXQ6PVFO7bHUd5jpApXvMIt55Ewz7UdMiC05ONxI= +github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1 h1:+dBg5k7nuTE38VVdoroRsT0Z88fmvdYrI2EjzJst35I= +github.com/withfig/autocomplete-tools/integrations/cobra v1.2.1/go.mod h1:nmuySobZb4kFgFy6BptpXp/BBw+xFSyvVPP6auoJB4k= github.com/xanzy/go-gitlab v0.31.0/go.mod h1:sPLojNBn68fMUWSxIJtdVVIP8uSBYqesTfDUseX11Ug= github.com/xanzy/go-gitlab v0.72.0 h1:/9BQTftUE7GRK/RO1eeWxG1cOE+tjwBrvRdpkeSOq6w= github.com/xanzy/go-gitlab v0.72.0/go.mod h1:d/a0vswScO7Agg1CZNz15Ic6SSvBG9vfw8egL99t4kA=