Skip to content

Commit ede4c54

Browse files
committed
but: change prefix
1 parent 943f3a9 commit ede4c54

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

pkg/actions/tools/but/cli.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func ActionCliIds(opts CliIdsOpts) carapace.Action {
3434

3535
if opts.Changes {
3636
for _, unassigned := range status.UnassignedChanges {
37-
batch = append(batch, carapace.ActionStyledValuesDescribed(unassigned.CliID, unassigned.FilePath, styleForChangeType(unassigned.ChangeType)).UidF(
37+
batch = append(batch, carapace.ActionStyledValuesDescribed(unassigned.CliID, unassigned.Description(), styleForChangeType(unassigned.ChangeType)).UidF(
3838
func(s string, uc uid.Context) (*url.URL, error) {
3939
return git.Uid("change")(unassigned.FilePath, uc)
4040
}))
@@ -44,7 +44,7 @@ func ActionCliIds(opts CliIdsOpts) carapace.Action {
4444
for _, stack := range status.Stacks {
4545
if opts.Changes {
4646
for _, assigned := range stack.AssignedChanges {
47-
batch = append(batch, carapace.ActionStyledValuesDescribed(assigned.CliID, assigned.FilePath, styleForChangeType(assigned.ChangeType)).UidF(
47+
batch = append(batch, carapace.ActionStyledValuesDescribed(assigned.CliID, assigned.Description(), styleForChangeType(assigned.ChangeType)).UidF(
4848
func(s string, uc uid.Context) (*url.URL, error) {
4949
return git.Uid("change")(assigned.FilePath, uc)
5050
}))

pkg/actions/tools/but/status.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ type butChange struct {
1414
ChangeType string `json:"changeType"`
1515
}
1616

17+
func (c butChange) Description() string {
18+
m := map[string]string{
19+
"added": "A",
20+
"removed": "D",
21+
"modified": "M",
22+
"renamed": "R",
23+
}
24+
return m[c.ChangeType] + " " + c.FilePath
25+
}
26+
1727
type butCommit struct {
1828
CliID string `json:"cliId"`
1929
CommitID string `json:"commitId"`

0 commit comments

Comments
 (0)