config-patch: update to new commands lib
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
Łukasz Magiera committed
Nov 25, 2017 at 03:01 UTC
c573d3d051bae5570404b77756592ba1689ae205
1 file changed
+11
-11
core/commands/config.go
+11
-11
@@ -295,7 +295,7 @@ can't be undone.
295
}
296
297
var configProfileCmd = &cmds.Command{
298
- Helptext: cmds.HelpText{
298
+ Helptext: cmdkit.HelpText{
299
Tagline: "Apply profiles to config.",
300
},
301
@@ -306,48 +306,48 @@ var configProfileCmd = &cmds.Command{
306
}
307
308
var configProfileApplyCmd = &cmds.Command{
309
- Helptext: cmds.HelpText{
309
+ Helptext: cmdkit.HelpText{
310
Tagline: "Apply profile to config.",
311
},
312
- Arguments: []cmds.Argument{
313
- cmds.StringArg("profile", true, false, "The profile to apply to the config."),
312
+ Arguments: []cmdkit.Argument{
313
+ cmdkit.StringArg("profile", true, false, "The profile to apply to the config."),
314
},
315
Run: func(req cmds.Request, res cmds.Response) {
316
profile, ok := config.Profiles[req.Arguments()[0]]
317
if !ok {
318
- res.SetError(fmt.Errorf("%s is not a profile", req.Arguments()[0]), cmds.ErrNormal)
318
+ res.SetError(fmt.Errorf("%s is not a profile", req.Arguments()[0]), cmdkit.ErrNormal)
319
return
320
}
321
322
err := transformConfig(req.InvocContext().ConfigRoot, profile.Apply)
323
if err != nil {
324
- res.SetError(err, cmds.ErrNormal)
324
+ res.SetError(err, cmdkit.ErrNormal)
325
return
326
}
327
},
328
}
329
330
var configProfileRevertCmd = &cmds.Command{
331
- Helptext: cmds.HelpText{
331
+ Helptext: cmdkit.HelpText{
332
Tagline: "Revert profile changes.",
333
ShortDescription: `Reverts profile-related changes to the config.
334
335
Reverting some profiles may damage the configuration or not be possible.
336
Backing up the config before running this command is advised.`,
337
},
338
- Arguments: []cmds.Argument{
339
- cmds.StringArg("profile", true, false, "The profile to apply to the config."),
338
+ Arguments: []cmdkit.Argument{
339
+ cmdkit.StringArg("profile", true, false, "The profile to apply to the config."),
340
},
341
Run: func(req cmds.Request, res cmds.Response) {
342
profile, ok := config.Profiles[req.Arguments()[0]]
343
if !ok {
344
- res.SetError(fmt.Errorf("%s is not a profile", req.Arguments()[0]), cmds.ErrNormal)
344
+ res.SetError(fmt.Errorf("%s is not a profile", req.Arguments()[0]), cmdkit.ErrNormal)
345
return
346
}
347
348
err := transformConfig(req.InvocContext().ConfigRoot, profile.Revert)
349
if err != nil {
350
- res.SetError(err, cmds.ErrNormal)
350
+ res.SetError(err, cmdkit.ErrNormal)
351
return
352
}
353
},