File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -108,8 +108,21 @@ func runInitCommand(cmd *cobra.Command, args []string) {
108
108
if err := newSettings .WriteConfigAs (configFileAbsPath .String ()); err != nil {
109
109
feedback .Fatal (tr ("Cannot create config file: %v" , err ), feedback .ErrGeneric )
110
110
}
111
+ feedback .PrintResult (initResult {ConfigFileAbsPath : configFileAbsPath })
112
+ }
113
+
114
+ // output from this command requires special formatting, let's create a dedicated
115
+ // feedback.Result implementation
116
+ type initResult struct {
117
+ ConfigFileAbsPath * paths.Path `json:"config_path"`
118
+ }
119
+
120
+ func (dr initResult ) Data () interface {} {
121
+ return dr
122
+ }
111
123
112
- msg := tr ("Config file written to: %s" , configFileAbsPath .String ())
124
+ func (dr initResult ) String () string {
125
+ msg := tr ("Config file written to: %s" , dr .ConfigFileAbsPath .String ())
113
126
logrus .Info (msg )
114
- feedback . Print ( msg )
127
+ return msg
115
128
}
You can’t perform that action at this time.
0 commit comments