Skip to content

Commit

Permalink
colour.CommandLineCode -> colour.Cmd everywhere
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Fawkesley committed Feb 19, 2019
1 parent 7d0ae13 commit 45329ed
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 20 deletions.
4 changes: 0 additions & 4 deletions colour/colour.go
Expand Up @@ -112,10 +112,6 @@ func TableHeader(message string) string {
}

func Cmd(message string) string {
return CommandLineCode(message)
}

func CommandLineCode(message string) string {
return bright + blue(message)
}

Expand Down
8 changes: 4 additions & 4 deletions fk/keyfromgpg.go
Expand Up @@ -40,9 +40,9 @@ func keyFromGpg() exitCode {
}

if len(availableKeys) == 0 {
out.Print(fmt.Sprintf("No new keys found with " + colour.CommandLineCode("gpg --list-secret-keys") + "\n\n"))
out.Print(fmt.Sprintf("No new keys found with " + colour.Cmd("gpg --list-secret-keys") + "\n\n"))
out.Print("See the keys you've already connected by running:\n")
out.Print(" " + colour.CommandLineCode("fk key list") + "\n\n")
out.Print(" " + colour.Cmd("fk key list") + "\n\n")

return 1
}
Expand Down Expand Up @@ -77,7 +77,7 @@ func keyFromGpg() exitCode {
out.Print(formatKeyWarnings(keyTask))

out.Print("Fluidkeys can fix these issues. See how by running:\n")
out.Print(" " + colour.CommandLineCode("fk key maintain --dry-run") + "\n\n")
out.Print(" " + colour.Cmd("fk key maintain --dry-run") + "\n\n")

return 0
}
Expand Down Expand Up @@ -108,7 +108,7 @@ func keysAvailableToGetFromGpg() ([]gpgwrapper.SecretKeyListing, error) {

func formatListedKeysForImportingFromGpg(secretKeyListings []gpgwrapper.SecretKeyListing) string {
str := "Found " + humanize.Pluralize(len(secretKeyListings), "key", "keys") +
" with " + colour.CommandLineCode("gpg --list-secret-keys") + ":\n\n"
" with " + colour.Cmd("gpg --list-secret-keys") + ":\n\n"
for index, key := range secretKeyListings {
str += printSecretKeyListing(index+1, key)
}
Expand Down
14 changes: 7 additions & 7 deletions fk/keymaintain.go
Expand Up @@ -82,11 +82,11 @@ func runKeyMaintainDryRun(keys []pgpkey.PgpKey) exitCode {
out.Print("You’ll be asked to confirm for each key.\n\n")
}

out.Print("Before running these actions, Fluidkeys makes a backup of " + colour.CommandLineCode("gpg") + ".\n")
out.Print("Before running these actions, Fluidkeys makes a backup of " + colour.Cmd("gpg") + ".\n")
out.Print(colour.Warning("Changes can only be undone by restoring from the backup.\n\n"))

out.Print("Fix these issues by running:\n")
out.Print(" " + colour.CommandLineCode("fk key maintain") + "\n\n")
out.Print(" " + colour.Cmd("fk key maintain") + "\n\n")
return 0
}

Expand All @@ -102,7 +102,7 @@ type keyTask struct {
}

var (
promptBackupAndRunActions = "Make a backup of " + colour.CommandLineCode("gpg") + " and run these actions?"
promptBackupAndRunActions = "Make a backup of " + colour.Cmd("gpg") + " and run these actions?"
promptRunActions = "Run these actions?"
promptMaintainAutomatically = "Automatically maintain this key from now on?"
)
Expand Down Expand Up @@ -233,7 +233,7 @@ func runKeyMaintain(keys []pgpkey.PgpKey, prompter promptYesNoInterface, passwor
humanize.Pluralize(numKeysNotPublished, "key hasn't", "keys haven't")+
" been uploaded to Fluidkeys.\n\n")))
out.Print("Make sure others can send you secrets by running:\n")
out.Print(" " + colour.CommandLineCode("fk key upload") + "\n\n")
out.Print(" " + colour.Cmd("fk key upload") + "\n\n")
}

return 0
Expand Down Expand Up @@ -339,7 +339,7 @@ func backupGpg() error {

func promptAndTurnOnMaintainAutomatically(prompter promptYesNoInterface, keyTask keyTask) {

out.Print("Fluidkeys can maintain this key automatically using " + colour.CommandLineCode("cron") + ".\n")
out.Print("Fluidkeys can maintain this key automatically using " + colour.Cmd("cron") + ".\n")
out.Print("This requires storing the password in the system keyring.\n\n")

if prompter.promptYesNo(promptMaintainAutomatically, "", keyTask.key) == true {
Expand Down Expand Up @@ -474,7 +474,7 @@ type loadPrivateKeyFromGnupg struct {
}

func (a loadPrivateKeyFromGnupg) String() string {
return "Load private key from " + colour.CommandLineCode("gpg")
return "Load private key from " + colour.Cmd("gpg")
}

func (a loadPrivateKeyFromGnupg) Enact(key *pgpkey.PgpKey, now time.Time, returnPassword *string) error {
Expand All @@ -501,7 +501,7 @@ type pushIntoGnupg struct {
}

func (a pushIntoGnupg) String() string {
return "Store updated key in " + colour.CommandLineCode("gpg")
return "Store updated key in " + colour.Cmd("gpg")
}

type passwordMap = map[fingerprint.Fingerprint]string
Expand Down
4 changes: 2 additions & 2 deletions fk/main.go
Expand Up @@ -345,7 +345,7 @@ func secretSubcommand(args docopt.Opts) exitCode {

printFailed("That doesn't look like an email address.")
out.Print(" Were you trying to send a file?\n\n")
out.Print(" > " + colour.CommandLineCode(
out.Print(" > " + colour.Cmd(
"fk secret send "+emailAddress+" --to=<email>\n\n"))
return 1
} else {
Expand All @@ -356,7 +356,7 @@ func secretSubcommand(args docopt.Opts) exitCode {
printFailed("That format is deprecated and will be removed.")
out.Print(" Please run this command next time:\n")

out.Print(" > " + colour.CommandLineCode(
out.Print(" > " + colour.Cmd(
"fk secret send --to="+emailAddress+"\n\n"))
}
} else if emailAddress, err = args.String("--to"); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion fk/setup.go
Expand Up @@ -64,7 +64,7 @@ func setup(email string) exitCode {
time.Sleep(3 * time.Second)

out.Print("🛎️ You've got a new secret. Read it by running:\n\n")
out.Print(colour.CommandLineCode("fk secret receive") + "\n\n")
out.Print(colour.Cmd("fk secret receive") + "\n\n")

return 0
}
Expand Down
4 changes: 2 additions & 2 deletions keytable/keytable.go
Expand Up @@ -222,8 +222,8 @@ func makePrimaryInstruction(keysWithWarnings []KeyWithWarnings) string {
} else { // These aren't urgent issues
output = "Fix these issues by running:\n"
}
output += " " + colour.CommandLineCode("fk key maintain") + "\n"
output += " " + colour.CommandLineCode("fk key upload") + "\n\n"
output += " " + colour.Cmd("fk key maintain") + "\n"
output += " " + colour.Cmd("fk key upload") + "\n\n"
}
return output
}
Expand Down

0 comments on commit 45329ed

Please sign in to comment.