Added whether the gist is public or secret. Added the colour red to public and the colour green to secret

This commit is contained in:
Icen 2022-07-22 20:58:29 +01:00
parent 02881b4783
commit df2b19567b

View file

@ -115,6 +115,7 @@ func createRun(opts *CreateOptions) error {
return fmt.Errorf("failed to collect files for posting: %w", err)
}
cs := opts.IO.ColorScheme()
gistName := guessGistName(files)
processMessage := "Creating gist..."
@ -125,11 +126,13 @@ func createRun(opts *CreateOptions) error {
} else {
processMessage = fmt.Sprintf("Creating gist %s", gistName)
}
completionMessage = fmt.Sprintf("Created gist %s", gistName)
if opts.Public {
completionMessage = fmt.Sprintf("Created %s gist %s", cs.Red("public"), gistName)
} else {
completionMessage = fmt.Sprintf("Created %s gist %s", cs.Green("secret"), gistName)
}
}
cs := opts.IO.ColorScheme()
errOut := opts.IO.ErrOut
fmt.Fprintf(errOut, "%s %s\n", cs.Gray("-"), processMessage)