Addressing nits

Signed-off-by: Diogo Monica <diogo@docker.com>
This commit is contained in:
Diogo Monica 2015-07-28 19:35:29 -07:00
parent a23bac9130
commit 59b02db807
2 changed files with 5 additions and 4 deletions

View File

@ -45,7 +45,8 @@ var cmdCertRemove = &cobra.Command{
// certRemove deletes a certificate given a cert ID or a gun // certRemove deletes a certificate given a cert ID or a gun
func certRemove(cmd *cobra.Command, args []string) { func certRemove(cmd *cobra.Command, args []string) {
// If the user hasn't provided -g with a gun, or a cert ID, show usage // If the user hasn't provided -g with a gun, or a cert ID, show usage
if len(args) < 1 && certRemoveGUN == "" { // If the user provided -g and a cert ID, also show usage
if (len(args) < 1 && certRemoveGUN == "") || (len(args) > 0 && certRemoveGUN != "") {
cmd.Usage() cmd.Usage()
fatalf("must specify the cert ID or the GUN of the certificates to remove") fatalf("must specify the cert ID or the GUN of the certificates to remove")
} }
@ -82,14 +83,14 @@ func certRemove(cmd *cobra.Command, args []string) {
} }
// List all the keys about to be removed // List all the keys about to be removed
fmt.Println("Are you sure you want to remove the following certificates?") fmt.Printf("The following certificates will be removed:\n\n")
for _, cert := range certsToRemove { for _, cert := range certsToRemove {
// This error can't occur because we're getting certs off of an // This error can't occur because we're getting certs off of an
// x509 store that indexes by ID. // x509 store that indexes by ID.
certID, _ := trustmanager.FingerprintCert(cert) certID, _ := trustmanager.FingerprintCert(cert)
fmt.Printf("%s - %s\n", cert.Subject.CommonName, certID) fmt.Printf("%s - %s\n", cert.Subject.CommonName, certID)
} }
fmt.Println("(yes/no)") fmt.Println("\nAre you sure you want to remove these certificates? (yes/no)")
// Ask for confirmation before removing certificates // Ask for confirmation before removing certificates
confirmed := askConfirm() confirmed := askConfirm()

View File

@ -122,7 +122,7 @@ func tufInit(cmd *cobra.Command, args []string) {
rootKeyID = keyID rootKeyID = keyID
} }
fmt.Printf("Root key found, using: %s", rootKeyID) fmt.Printf("Root key found, using: %s\n", rootKeyID)
} }
rootCryptoService, err := nRepo.KeyStoreManager.GetRootCryptoService(rootKeyID) rootCryptoService, err := nRepo.KeyStoreManager.GetRootCryptoService(rootKeyID)