File tree 1 file changed +14
-2
lines changed
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package core
2
2
3
3
import (
4
4
"encoding/json"
5
+ "fmt"
5
6
"strings"
6
7
7
8
"github.com/fatih/color"
@@ -10,8 +11,14 @@ import (
10
11
)
11
12
12
13
type SuccessResult struct {
13
- Message string
14
- Details string
14
+ Message string
15
+ Details string
16
+ Resource string
17
+ Verb string
18
+ }
19
+
20
+ var standardSuccessMessages = map [string ]string {
21
+ "delete" : "%s has been successfully deleted." ,
15
22
}
16
23
17
24
func (s * SuccessResult ) MarshalHuman () (string , error ) {
@@ -45,5 +52,10 @@ func (s *SuccessResult) getMessage() string {
45
52
if s .Message != "" {
46
53
return s .Message
47
54
}
55
+
56
+ if messageTemplate , exists := standardSuccessMessages [s .Verb ]; exists && s .Resource != "" {
57
+ return fmt .Sprintf (messageTemplate , s .Resource )
58
+ }
59
+
48
60
return "Success"
49
61
}
You can’t perform that action at this time.
0 commit comments