From 0a5522dfce86a0bb4ea1db23a4eb92f8203f68e9 Mon Sep 17 00:00:00 2001 From: rsteube Date: Thu, 2 Mar 2023 11:00:45 +0100 Subject: [PATCH] added conda-content-trust --- .../cmd/gpgKeyLookup.go | 19 +++++++++++++++ .../cmd/gpgSign.go | 24 +++++++++++++++++++ .../cmd/modifyMetadata.go | 23 ++++++++++++++++++ .../conda-content-trust_completer/cmd/root.go | 23 ++++++++++++++++++ .../cmd/signArtifacts.go | 23 ++++++++++++++++++ .../cmd/verifyMetadata.go | 24 +++++++++++++++++++ .../conda-content-trust_completer/main.go | 7 ++++++ completers/conda_completer/cmd/root.go | 2 +- 8 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 completers/conda-content-trust_completer/cmd/gpgKeyLookup.go create mode 100644 completers/conda-content-trust_completer/cmd/gpgSign.go create mode 100644 completers/conda-content-trust_completer/cmd/modifyMetadata.go create mode 100644 completers/conda-content-trust_completer/cmd/root.go create mode 100644 completers/conda-content-trust_completer/cmd/signArtifacts.go create mode 100644 completers/conda-content-trust_completer/cmd/verifyMetadata.go create mode 100644 completers/conda-content-trust_completer/main.go diff --git a/completers/conda-content-trust_completer/cmd/gpgKeyLookup.go b/completers/conda-content-trust_completer/cmd/gpgKeyLookup.go new file mode 100644 index 0000000000..073c2078fc --- /dev/null +++ b/completers/conda-content-trust_completer/cmd/gpgKeyLookup.go @@ -0,0 +1,19 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var gpgKeyLookupCmd = &cobra.Command{ + Use: "gpg-key-lookup", + Short: "Fetch the actual ed25519 public key value of the underlying key", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(gpgKeyLookupCmd).Standalone() + gpgKeyLookupCmd.Flags().BoolP("help", "h", false, "show this help message and exit") + + rootCmd.AddCommand(gpgKeyLookupCmd) +} diff --git a/completers/conda-content-trust_completer/cmd/gpgSign.go b/completers/conda-content-trust_completer/cmd/gpgSign.go new file mode 100644 index 0000000000..553aa1b07c --- /dev/null +++ b/completers/conda-content-trust_completer/cmd/gpgSign.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var gpgSignCmd = &cobra.Command{ + Use: "gpg-sign", + Short: "Sign a given piece of metadata usign GPG", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(gpgSignCmd).Standalone() + + gpgSignCmd.Flags().BoolP("help", "h", false, "show this help message and exit") + rootCmd.AddCommand(gpgSignCmd) + + carapace.Gen(gpgSignCmd).PositionalCompletion( + carapace.ActionValues(), + carapace.ActionFiles(), + ) +} diff --git a/completers/conda-content-trust_completer/cmd/modifyMetadata.go b/completers/conda-content-trust_completer/cmd/modifyMetadata.go new file mode 100644 index 0000000000..7bfba2bc45 --- /dev/null +++ b/completers/conda-content-trust_completer/cmd/modifyMetadata.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var modifyMetadataCmd = &cobra.Command{ + Use: "modify-metadata", + Short: "Modify metadata file", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(modifyMetadataCmd).Standalone() + + modifyMetadataCmd.Flags().BoolP("help", "h", false, "show this help message and exit") + rootCmd.AddCommand(modifyMetadataCmd) + + carapace.Gen(modifyMetadataCmd).PositionalCompletion( + carapace.ActionFiles(), + ) +} diff --git a/completers/conda-content-trust_completer/cmd/root.go b/completers/conda-content-trust_completer/cmd/root.go new file mode 100644 index 0000000000..67402fbcce --- /dev/null +++ b/completers/conda-content-trust_completer/cmd/root.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var rootCmd = &cobra.Command{ + Use: "conda-content-trust", + Short: "Signing and verification tools for Conda", + Long: "https://github.com/conda/conda-content-trust", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func Execute() error { + return rootCmd.Execute() +} +func init() { + carapace.Gen(rootCmd).Standalone() + + rootCmd.Flags().BoolP("help", "h", false, "show this help message and exit") + rootCmd.Flags().BoolP("version", "V", false, "Show the conda-content-trust version number and exit.") +} diff --git a/completers/conda-content-trust_completer/cmd/signArtifacts.go b/completers/conda-content-trust_completer/cmd/signArtifacts.go new file mode 100644 index 0000000000..6ed750a3e5 --- /dev/null +++ b/completers/conda-content-trust_completer/cmd/signArtifacts.go @@ -0,0 +1,23 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var signArtifactsCmd = &cobra.Command{ + Use: "sign-artifacts", + Short: "Produce artifact signatures and update repodata.json", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(signArtifactsCmd).Standalone() + + signArtifactsCmd.Flags().BoolP("help", "h", false, "show this help message and exit") + rootCmd.AddCommand(signArtifactsCmd) + + carapace.Gen(signArtifactsCmd).PositionalCompletion( + carapace.ActionFiles(), + ) +} diff --git a/completers/conda-content-trust_completer/cmd/verifyMetadata.go b/completers/conda-content-trust_completer/cmd/verifyMetadata.go new file mode 100644 index 0000000000..a6a9553bbf --- /dev/null +++ b/completers/conda-content-trust_completer/cmd/verifyMetadata.go @@ -0,0 +1,24 @@ +package cmd + +import ( + "github.com/rsteube/carapace" + "github.com/spf13/cobra" +) + +var verifyMetadataCmd = &cobra.Command{ + Use: "verify-metadata", + Short: "Verify metadata file", + Run: func(cmd *cobra.Command, args []string) {}, +} + +func init() { + carapace.Gen(verifyMetadataCmd).Standalone() + + verifyMetadataCmd.Flags().BoolP("help", "h", false, "show this help message and exit") + rootCmd.AddCommand(verifyMetadataCmd) + + carapace.Gen(verifyMetadataCmd).PositionalCompletion( + carapace.ActionFiles(), + carapace.ActionFiles(), + ) +} diff --git a/completers/conda-content-trust_completer/main.go b/completers/conda-content-trust_completer/main.go new file mode 100644 index 0000000000..0942313d66 --- /dev/null +++ b/completers/conda-content-trust_completer/main.go @@ -0,0 +1,7 @@ +package main + +import "github.com/rsteube/carapace-bin/completers/conda-content-trust_completer/cmd" + +func main() { + cmd.Execute() +} diff --git a/completers/conda_completer/cmd/root.go b/completers/conda_completer/cmd/root.go index 1b93f46aea..9fe190b219 100644 --- a/completers/conda_completer/cmd/root.go +++ b/completers/conda_completer/cmd/root.go @@ -30,7 +30,7 @@ func init() { func addOtherCommands() { // hardcoded for now (should check PATH for conda-{COMMAND}) others := map[string]string{ - "content-trust": "", + "content-trust": "Signing and verification tools for Conda", "env": "Manage conda environments", } for name, description := range others {