chore: use Printf() instead of Println(Sprintf())

This commit is contained in:
Wiktor W. 2024-01-05 19:16:54 +01:00
parent 192d430039
commit 0c4d5b2e69
5 changed files with 18 additions and 21 deletions

View File

@ -270,17 +270,17 @@ can take some time.
table.Render()
if status {
fmt.Println(fmt.Sprintf(
"server: %s | total apps: %v | versioned: %v | unversioned: %v | latest: %v | upgrade: %v",
fmt.Printf(
"server: %s | total apps: %v | versioned: %v | unversioned: %v | latest: %v | upgrade: %v\n",
app.Server,
serverStat.AppCount,
serverStat.VersionCount,
serverStat.UnversionedCount,
serverStat.LatestCount,
serverStat.UpgradeCount,
))
)
} else {
fmt.Println(fmt.Sprintf("server: %s | total apps: %v", app.Server, serverStat.AppCount))
fmt.Printf("server: %s | total apps: %v\n", app.Server, serverStat.AppCount)
}
}
@ -292,7 +292,7 @@ can take some time.
}
if len(allStats) > 1 {
fmt.Println(fmt.Sprintf("total servers: %v | total apps: %v ", totalServersCount, totalAppsCount))
fmt.Printf("total servers: %v | total apps: %v\n", totalServersCount, totalAppsCount)
}
return nil

View File

@ -141,15 +141,15 @@ var appNewCommand = cli.Command{
table := formatter.CreateTable(tableCol)
table.Append([]string{internal.NewAppServer, recipe.Name, internal.Domain})
fmt.Println(fmt.Sprintf("A new %s app has been created! Here is an overview:", recipe.Name))
fmt.Printf("A new %s app has been created! Here is an overview:\n", recipe.Name)
fmt.Println("")
table.Render()
fmt.Println("")
fmt.Println("You can configure this app by running the following:")
fmt.Println(fmt.Sprintf("\n abra app config %s", internal.Domain))
fmt.Printf("\n abra app config %s\n", internal.Domain)
fmt.Println("")
fmt.Println("You can deploy this app by running the following:")
fmt.Println(fmt.Sprintf("\n abra app deploy %s", internal.Domain))
fmt.Printf("\n abra app deploy %s\n", internal.Domain)
if len(secrets) > 0 {
fmt.Println("")

View File

@ -80,29 +80,26 @@ Example:
switch shellType {
case "bash":
fmt.Println(fmt.Sprintf(`
# Run the following commands to install auto-completion
fmt.Printf(`# Run the following commands to install auto-completion
sudo mkdir /etc/bash_completion.d/
sudo cp %s /etc/bash_completion.d/abra
echo "source /etc/bash_completion.d/abra" >> ~/.bashrc
# To test, run the following: "abra app <hit tab key>" - you should see command completion!
`, autocompletionFile))
`, autocompletionFile)
case "zsh":
fmt.Println(fmt.Sprintf(`
# Run the following commands to install auto-completion
fmt.Printf(`# Run the following commands to install auto-completion
sudo mkdir /etc/zsh/completion.d/
sudo cp %s /etc/zsh/completion.d/abra
echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc
# To test, run the following: "abra app <hit tab key>" - you should see command completion!
`, autocompletionFile))
`, autocompletionFile)
case "fish":
fmt.Println(fmt.Sprintf(`
# Run the following commands to install auto-completion
fmt.Printf(`# Run the following commands to install auto-completion
sudo mkdir -p /etc/fish/completions
sudo cp %s /etc/fish/completions/abra
echo "source /etc/fish/completions/abra" >> ~/.config/fish/config.fish
# To test, run the following: "abra app <hit tab key>" - you should see command completion!
`, autocompletionFile))
`, autocompletionFile)
}
return nil

View File

@ -103,7 +103,7 @@ recipe and domain in the sample environment config).
logrus.Fatal(err)
}
fmt.Print(fmt.Sprintf(`
fmt.Printf(`
Your new %s recipe has been created in %s.
In order to share your recipe, you can upload it the git repository to:
@ -118,7 +118,7 @@ See "abra recipe -h" for additional recipe maintainer commands.
Happy Hacking!
`, recipeName, path.Join(config.RECIPES_DIR, recipeName), recipeName))
`, recipeName, path.Join(config.RECIPES_DIR, recipeName), recipeName)
return nil
},

View File

@ -68,7 +68,7 @@ local file system.
if internal.NoInput {
logrus.Fatalf("unable to continue, input required for initial version")
}
fmt.Println(fmt.Sprintf(`
fmt.Printf(`
The following options are two types of initial semantic version that you can
pick for %s that will be published in the recipe catalogue. This follows the
semver convention (more on https://semver.org), here is a short cheatsheet
@ -85,7 +85,7 @@ If you want people to be able alpha test your current config for %s but don't
think it is quite reliable, go with 0.1.0 and people will know that things are
likely to change.
`, recipe.Name, recipe.Name))
`, recipe.Name, recipe.Name)
var chosenVersion string
edPrompt := &survey.Select{
Message: "which version do you want to begin with?",