use a red colored stderr writer for the cobra cmd errors

This commit is contained in:
Gani Georgiev
2023-12-03 13:44:30 +02:00
parent 070a1cd6d9
commit 5b94aced3a
3 changed files with 37 additions and 16 deletions
+3 -6
View File
@@ -105,12 +105,9 @@ func (p *plugin) updateCmd() *cobra.Command {
var withBackup bool
command := &cobra.Command{
Use: "update",
Short: "Automatically updates the current PocketBase executable with the latest available version",
// @todo remove after logs generalization
// prevents printing the error log twice
SilenceErrors: true,
SilenceUsage: true,
Use: "update",
Short: "Automatically updates the current PocketBase executable with the latest available version",
SilenceUsage: true,
RunE: func(command *cobra.Command, args []string) error {
var needConfirm bool
if isMaybeRunningInDocker() {
+5 -7
View File
@@ -118,13 +118,11 @@ func (p *plugin) createCommand() *cobra.Command {
`
command := &cobra.Command{
Use: "migrate",
Short: "Executes app DB migration scripts",
Long: cmdDesc,
ValidArgs: []string{"up", "down", "create", "collections"},
// prevents printing the error log twice
SilenceErrors: true,
SilenceUsage: true,
Use: "migrate",
Short: "Executes app DB migration scripts",
Long: cmdDesc,
ValidArgs: []string{"up", "down", "create", "collections"},
SilenceUsage: true,
RunE: func(command *cobra.Command, args []string) error {
cmd := ""
if len(args) > 0 {