mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-25 13:57:56 +02:00
Mark user interface strings
For now exclude command help, as cobra itself is not localizable yet.
This commit is contained in:
parent
511b71b909
commit
d6ca8d33f7
27 changed files with 1005 additions and 95 deletions
|
@ -26,29 +26,30 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
"go.uploadedlobster.com/scotty/internal/cli"
|
||||
"go.uploadedlobster.com/scotty/internal/i18n"
|
||||
)
|
||||
|
||||
var serviceDeleteCmd = &cobra.Command{
|
||||
Use: "delete",
|
||||
Short: "Delete existing service configuration",
|
||||
Long: `Delete an existing service configuration.`,
|
||||
Long: `Delete an existing service from the configuration file.`,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
service, err := cli.SelectService()
|
||||
cobra.CheckErr(err)
|
||||
|
||||
// Prompt for deletion
|
||||
delete, err := cli.PromptYesNo(fmt.Sprintf("Delete the service configuration \"%v\"?", service))
|
||||
delete, err := cli.PromptYesNo(i18n.Tr("Delete the service configuration \"%v\"?", service))
|
||||
cobra.CheckErr(err)
|
||||
|
||||
if !delete {
|
||||
fmt.Println("Aborted")
|
||||
fmt.Println(i18n.Tr("Aborted"))
|
||||
return
|
||||
}
|
||||
|
||||
// Delete the service config
|
||||
err = service.Delete()
|
||||
cobra.CheckErr(err)
|
||||
fmt.Printf("Service \"%v\" deleted\n", service.Name)
|
||||
fmt.Println(i18n.Tr("Service \"%v\" deleted\n", service.Name))
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue