/
revert.go
39 lines (36 loc) · 1.15 KB
/
revert.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package cmdtree
import (
"github.com/ActiveState/cli/internal/captain"
"github.com/ActiveState/cli/internal/locale"
"github.com/ActiveState/cli/internal/primer"
"github.com/ActiveState/cli/internal/runners/revert"
)
func newRevertCommand(prime *primer.Values, globals *globalOptions) *captain.Command {
runner := revert.New(prime)
params := &revert.Params{}
return captain.NewCommand(
"revert",
locale.Tl("revert_title", "Reverting Commit"),
locale.Tl("revert_description", "Revert a commit"),
prime,
[]*captain.Flag{
{
Name: "to",
Description: locale.Tl("revert_arg_to", "Create a new commit that brings the runtime back to the same state as the commit given"),
Value: ¶ms.To,
},
},
[]*captain.Argument{
{
Name: "commit-id",
Description: locale.Tl("revert_arg_commit_id", "The commit ID to revert changes from, or HEAD for the latest commit"),
Required: true,
Value: ¶ms.CommitID,
},
},
func(ccmd *captain.Command, args []string) error {
params.Force = globals.NonInteractive
return runner.Run(params)
},
).SetGroup(VCSGroup).SetSupportsStructuredOutput()
}