Skip to content

Commit 0496c33

Browse files
committed
refactor into single func
1 parent 162f93f commit 0496c33

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

pbm/ctrl/send.go

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -93,37 +93,15 @@ func SendRemoveConfigProfile(ctx context.Context, m connect.Client, name string)
9393
return sendCommand(ctx, m, cmd)
9494
}
9595

96-
func SendResync(ctx context.Context, m connect.Client) (OPID, error) {
97-
return sendCommand(ctx, m, Cmd{Cmd: CmdResync})
98-
}
99-
100-
func SendSyncMetaFrom(ctx context.Context, m connect.Client, name string) (OPID, error) {
101-
opts := &ResyncCmd{}
102-
if name != "" {
103-
opts.Name = name
104-
} else {
105-
opts.All = true
106-
}
107-
96+
func SendResync(ctx context.Context, m connect.Client, opts *ResyncCmd) (OPID, error) {
10897
cmd := Cmd{
109-
Cmd: CmdResync,
110-
Resync: opts,
98+
Cmd: CmdResync,
11199
}
112-
return sendCommand(ctx, m, cmd)
113-
}
114100

115-
func SendClearMetaFrom(ctx context.Context, m connect.Client, name string) (OPID, error) {
116-
opts := &ResyncCmd{Clear: true}
117-
if name != "" {
118-
opts.Name = name
119-
} else {
120-
opts.All = true
101+
if opts != nil {
102+
cmd.Resync = opts
121103
}
122104

123-
cmd := Cmd{
124-
Cmd: CmdResync,
125-
Resync: opts,
126-
}
127105
return sendCommand(ctx, m, cmd)
128106
}
129107

0 commit comments

Comments
 (0)