Skip to content

Commit 3133461

Browse files
authored
Merge pull request #3289 from Saurabh825/keytool
Add keytool completer
2 parents 90e5888 + e56ced3 commit 3133461

20 files changed

+634
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var certreqCmd = &cobra.Command{
9+
Use: "certreq",
10+
Aliases: []string{"certreq"},
11+
Short: "Generates a certificate request",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(certreqCmd).Standalone()
17+
18+
certreqCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
certreqCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
certreqCmd.Flags().StringS("dname", "dname", "", "distinguished name")
21+
certreqCmd.Flags().StringS("ext", "ext", "", "X.509 extension")
22+
certreqCmd.Flags().StringS("file", "file", "", "output file name")
23+
certreqCmd.Flags().StringS("keypass", "keypass", "", "key password")
24+
certreqCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
25+
certreqCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
26+
certreqCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
27+
certreqCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
28+
certreqCmd.Flags().StringS("providername", "providername", "", "provider name")
29+
certreqCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
30+
certreqCmd.Flags().StringS("sigalg", "sigalg", "", "signature algorithm name")
31+
certreqCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
32+
certreqCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
33+
certreqCmd.Flags().BoolS("v", "v", false, "verbose output")
34+
35+
carapace.Gen(certreqCmd).FlagCompletion(carapace.ActionMap{
36+
"file": carapace.ActionFiles(),
37+
})
38+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var changealiasCmd = &cobra.Command{
9+
Use: "changealias",
10+
Aliases: []string{"changealias"},
11+
Short: "Changes an entry's alias",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(changealiasCmd).Standalone()
17+
18+
changealiasCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
changealiasCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
changealiasCmd.Flags().BoolS("cacerts", "cacerts", false, "access the cacerts keystore")
21+
changealiasCmd.Flags().StringS("destalias", "destalias", "", "destination alias")
22+
changealiasCmd.Flags().StringS("keypass", "keypass", "", "key password")
23+
changealiasCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
24+
changealiasCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
25+
changealiasCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
26+
changealiasCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
27+
changealiasCmd.Flags().StringS("providername", "providername", "", "provider name")
28+
changealiasCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
29+
changealiasCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
30+
changealiasCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
31+
changealiasCmd.Flags().BoolS("v", "v", false, "verbose output")
32+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var deleteCmd = &cobra.Command{
9+
Use: "delete",
10+
Aliases: []string{"delete"},
11+
Short: "Deletes an entry",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(deleteCmd).Standalone()
17+
18+
deleteCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
deleteCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
deleteCmd.Flags().BoolS("cacerts", "cacerts", false, "access the cacerts keystore")
21+
deleteCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
22+
deleteCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
23+
deleteCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
24+
deleteCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
25+
deleteCmd.Flags().StringS("providername", "providername", "", "provider name")
26+
deleteCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
27+
deleteCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
28+
deleteCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
29+
deleteCmd.Flags().BoolS("v", "v", false, "verbose output")
30+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var exportcertCmd = &cobra.Command{
9+
Use: "exportcert",
10+
Aliases: []string{"exportcert"},
11+
Short: "Exports certificate",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(exportcertCmd).Standalone()
17+
18+
exportcertCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
exportcertCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
exportcertCmd.Flags().BoolS("cacerts", "cacerts", false, "access the cacerts keystore")
21+
exportcertCmd.Flags().StringS("file", "file", "", "output file name")
22+
exportcertCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
23+
exportcertCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
24+
exportcertCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
25+
exportcertCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
26+
exportcertCmd.Flags().StringS("providername", "providername", "", "provider name")
27+
exportcertCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
28+
exportcertCmd.Flags().BoolS("rfc", "rfc", false, "output in RFC style")
29+
exportcertCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
30+
exportcertCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
31+
exportcertCmd.Flags().BoolS("v", "v", false, "verbose output")
32+
33+
carapace.Gen(exportcertCmd).FlagCompletion(carapace.ActionMap{
34+
"file": carapace.ActionFiles(),
35+
})
36+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var gencertCmd = &cobra.Command{
9+
Use: "gencert",
10+
Aliases: []string{"gencert"},
11+
Short: "Generates certificate from a certificate request",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(gencertCmd).Standalone()
17+
18+
gencertCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
gencertCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
gencertCmd.Flags().StringS("dname", "dname", "", "distinguished name")
21+
gencertCmd.Flags().StringS("ext", "ext", "", "X.509 extension")
22+
gencertCmd.Flags().StringS("infile", "infile", "", "input file name")
23+
gencertCmd.Flags().StringS("keypass", "keypass", "", "key password")
24+
gencertCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
25+
gencertCmd.Flags().StringS("outfile", "outfile", "", "output file name")
26+
gencertCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
27+
gencertCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
28+
gencertCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
29+
gencertCmd.Flags().StringS("providername", "providername", "", "provider name")
30+
gencertCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
31+
gencertCmd.Flags().BoolS("rfc", "rfc", false, "output in RFC style")
32+
gencertCmd.Flags().StringS("sigalg", "sigalg", "", "signature algorithm name")
33+
gencertCmd.Flags().StringS("startdate", "startdate", "", "certificate validity start date/time")
34+
gencertCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
35+
gencertCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
36+
gencertCmd.Flags().BoolS("v", "v", false, "verbose output")
37+
gencertCmd.Flags().StringS("validity", "validity", "", "validity number of days")
38+
39+
carapace.Gen(gencertCmd).FlagCompletion(carapace.ActionMap{
40+
"infile": carapace.ActionFiles(),
41+
"outfile": carapace.ActionFiles(),
42+
})
43+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var genkeypairCmd = &cobra.Command{
9+
Use: "genkeypair",
10+
Aliases: []string{"genkeypair"},
11+
Short: "Generates a key pair",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(genkeypairCmd).Standalone()
17+
18+
genkeypairCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
genkeypairCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
genkeypairCmd.Flags().StringS("dname", "dname", "", "distinguished name")
21+
genkeypairCmd.Flags().StringS("ext", "ext", "", "X.509 extension")
22+
genkeypairCmd.Flags().StringS("groupname", "groupname", "", "Group name. For example, an Elliptic Curve name.")
23+
genkeypairCmd.Flags().StringS("keyalg", "keyalg", "", "key algorithm name")
24+
genkeypairCmd.Flags().StringS("keypass", "keypass", "", "key password")
25+
genkeypairCmd.Flags().StringS("keysize", "keysize", "", "key bit size")
26+
genkeypairCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
27+
genkeypairCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
28+
genkeypairCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
29+
genkeypairCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
30+
genkeypairCmd.Flags().StringS("providername", "providername", "", "provider name")
31+
genkeypairCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
32+
genkeypairCmd.Flags().StringS("sigalg", "sigalg", "", "signature algorithm name")
33+
genkeypairCmd.Flags().StringS("signer", "signer", "", "signer alias")
34+
genkeypairCmd.Flags().StringS("signerkeypass", "signerkeypass", "", "signer key password")
35+
genkeypairCmd.Flags().StringS("startdate", "startdate", "", "certificate validity start date/time")
36+
genkeypairCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
37+
genkeypairCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
38+
genkeypairCmd.Flags().BoolS("v", "v", false, "verbose output")
39+
genkeypairCmd.Flags().StringS("validity", "validity", "", "validity number of days")
40+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var genseckeyCmd = &cobra.Command{
9+
Use: "genseckey",
10+
Aliases: []string{"genseckey"},
11+
Short: "Generates a secret key",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(genseckeyCmd).Standalone()
17+
18+
genseckeyCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
genseckeyCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
genseckeyCmd.Flags().StringS("keyalg", "keyalg", "", "key algorithm name")
21+
genseckeyCmd.Flags().StringS("keypass", "keypass", "", "key password")
22+
genseckeyCmd.Flags().StringS("keysize", "keysize", "", "key bit size")
23+
genseckeyCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
24+
genseckeyCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
25+
genseckeyCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
26+
genseckeyCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
27+
genseckeyCmd.Flags().StringS("providername", "providername", "", "provider name")
28+
genseckeyCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
29+
genseckeyCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
30+
genseckeyCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
31+
genseckeyCmd.Flags().BoolS("v", "v", false, "verbose output")
32+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var importcertCmd = &cobra.Command{
9+
Use: "importcert",
10+
Aliases: []string{"importcert"},
11+
Short: "Imports a certificate or a certificate chain",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(importcertCmd).Standalone()
17+
18+
importcertCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
importcertCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
importcertCmd.Flags().BoolS("cacerts", "cacerts", false, "access the cacerts keystore")
21+
importcertCmd.Flags().StringS("file", "file", "", "input file name")
22+
importcertCmd.Flags().StringS("keypass", "keypass", "", "key password")
23+
importcertCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
24+
importcertCmd.Flags().BoolS("noprompt", "noprompt", false, "do not prompt")
25+
importcertCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
26+
importcertCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
27+
importcertCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
28+
importcertCmd.Flags().StringS("providername", "providername", "", "provider name")
29+
importcertCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
30+
importcertCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
31+
importcertCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
32+
importcertCmd.Flags().BoolS("trustcacerts", "trustcacerts", false, "trust certificates from cacerts")
33+
importcertCmd.Flags().BoolS("v", "v", false, "verbose output")
34+
35+
carapace.Gen(importcertCmd).FlagCompletion(carapace.ActionMap{
36+
"file": carapace.ActionFiles(),
37+
})
38+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var importkeystoreCmd = &cobra.Command{
9+
Use: "importkeystore",
10+
Aliases: []string{"importkeystore"},
11+
Short: "Imports one or all entries from another keystore",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(importkeystoreCmd).Standalone()
17+
18+
importkeystoreCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
importkeystoreCmd.Flags().StringS("destalias", "destalias", "", "destination alias")
20+
importkeystoreCmd.Flags().StringS("destkeypass", "destkeypass", "", "destination key password")
21+
importkeystoreCmd.Flags().StringS("destkeystore", "destkeystore", "", "destination keystore name")
22+
importkeystoreCmd.Flags().BoolS("destprotected", "destprotected", false, "destination keystore password protected")
23+
importkeystoreCmd.Flags().StringS("destprovidername", "destprovidername", "", "destination keystore provider name")
24+
importkeystoreCmd.Flags().StringS("deststorepass", "deststorepass", "", "destination keystore password")
25+
importkeystoreCmd.Flags().StringS("deststoretype", "deststoretype", "", "destination keystore type")
26+
importkeystoreCmd.Flags().BoolS("noprompt", "noprompt", false, "do not prompt")
27+
importkeystoreCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
28+
importkeystoreCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
29+
importkeystoreCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
30+
importkeystoreCmd.Flags().StringS("srcalias", "srcalias", "", "source alias")
31+
importkeystoreCmd.Flags().StringS("srckeypass", "srckeypass", "", "source key password")
32+
importkeystoreCmd.Flags().StringS("srckeystore", "srckeystore", "", "source keystore name")
33+
importkeystoreCmd.Flags().BoolS("srcprotected", "srcprotected", false, "source keystore password protected")
34+
importkeystoreCmd.Flags().StringS("srcprovidername", "srcprovidername", "", "source keystore provider name")
35+
importkeystoreCmd.Flags().StringS("srcstorepass", "srcstorepass", "", "source keystore password")
36+
importkeystoreCmd.Flags().StringS("srcstoretype", "srcstoretype", "", "source keystore type")
37+
importkeystoreCmd.Flags().BoolS("v", "v", false, "verbose output")
38+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package cmd
2+
3+
import (
4+
"github.com/carapace-sh/carapace"
5+
"github.com/spf13/cobra"
6+
)
7+
8+
var importpassCmd = &cobra.Command{
9+
Use: "importpass",
10+
Aliases: []string{"importpass"},
11+
Short: "Imports a password",
12+
Run: func(cmd *cobra.Command, args []string) {},
13+
}
14+
15+
func init() {
16+
carapace.Gen(importpassCmd).Standalone()
17+
18+
importpassCmd.Flags().StringS("addprovider", "addprovider", "", "add security provider by name (e.g. SunPKCS11)")
19+
importpassCmd.Flags().StringS("alias", "alias", "", "alias name of the entry to process")
20+
importpassCmd.Flags().StringS("keyalg", "keyalg", "", "key algorithm name")
21+
importpassCmd.Flags().StringS("keypass", "keypass", "", "key password")
22+
importpassCmd.Flags().StringS("keysize", "keysize", "", "key bit size")
23+
importpassCmd.Flags().StringS("keystore", "keystore", "", "keystore name")
24+
importpassCmd.Flags().BoolS("protected", "protected", false, "password through protected mechanism")
25+
importpassCmd.Flags().StringArrayS("providerarg", "providerarg", nil, "configure argument for -addprovider/-providerclass")
26+
importpassCmd.Flags().StringS("providerclass", "providerclass", "", "add security provider by fully-qualified class name")
27+
importpassCmd.Flags().StringS("providername", "providername", "", "provider name")
28+
importpassCmd.Flags().StringS("providerpath", "providerpath", "", "provider classpath")
29+
importpassCmd.Flags().StringS("storepass", "storepass", "", "keystore password")
30+
importpassCmd.Flags().StringS("storetype", "storetype", "", "keystore type")
31+
importpassCmd.Flags().BoolS("v", "v", false, "verbose output")
32+
}

0 commit comments

Comments
 (0)