Skip to content

Commit 0d26aa0

Browse files
Bruce Hillyjp20
authored andcommitted
Resolve merge issues
1 parent 0ad1e2c commit 0d26aa0

File tree

3 files changed

+38
-46
lines changed

3 files changed

+38
-46
lines changed

pkg/cmd/build.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,14 +154,14 @@ var buildsList = cli.Command{
154154
&requestflag.Flag[float64]{
155155
Name: "limit",
156156
Usage: "Maximum number of builds to return, defaults to 10 (maximum: 100).",
157-
Default: 10,
157+
Default: 10,
158158
DefaultText: "10",
159-
QueryPath: "limit",
159+
QueryPath: "limit",
160160
},
161161
&requestflag.Flag[any]{
162162
Name: "revision",
163163
Usage: "A config commit SHA used for the build",
164-
Default: requestflag.Value[any](map[string]any{}),
164+
Default: map[string]any{},
165165
QueryPath: "revision",
166166
},
167167
},
@@ -211,7 +211,7 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
211211
var revision map[string]map[string]map[string][]byte
212212
if cmd.IsSet("revision") {
213213
var ok bool
214-
revision, ok = requestflag.CommandRequestValue[any](cmd, "revision").(map[string]map[string]map[string][]byte)
214+
revision, ok = cmd.Value("revision").(map[string]map[string]map[string][]byte)
215215
if !ok {
216216
revision = make(map[string]map[string]map[string][]byte)
217217
}

pkg/cmd/buildtargetoutput.go

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,15 @@ var buildsTargetOutputsRetrieve = cli.Command{
3333
Name: "project",
3434
Usage: "Project name (required when build-id is not provided)",
3535
},
36-
&requestflag.StringFlag{
37-
Name: "branch",
38-
Usage: "Branch name (defaults to main if not provided)",
39-
Value: requestflag.Value[string]("main"),
40-
DefaultText: "main",
36+
&requestflag.Flag[string]{
37+
Name: "branch",
38+
Usage: "Branch name (defaults to main if not provided)",
39+
Default: "main",
4140
},
42-
&requestflag.StringSliceFlag{
43-
Name: "target",
44-
Usage: "SDK language target name(s). Can be specified multiple times.",
45-
Config: requestflag.RequestConfig{
46-
QueryPath: "target",
47-
},
41+
&requestflag.Flag[string]{
42+
Name: "target",
43+
Usage: "SDK language target name(s). Can be specified multiple times.",
44+
QueryPath: "target",
4845
},
4946
&requestflag.Flag[string]{
5047
Name: "type",
@@ -53,9 +50,9 @@ var buildsTargetOutputsRetrieve = cli.Command{
5350
&requestflag.Flag[string]{
5451
Name: "output",
5552
Usage: "Output format: url (download URL) or git (temporary access token).",
56-
Default: requestflag.Value[string]("url"),
53+
DefaultText: "url",
5754
HideDefault: true,
58-
QueryPath: "output",
55+
QueryPath: "output",
5956
},
6057
},
6158
Before: before,
@@ -87,7 +84,7 @@ func handleBuildsTargetOutputsRetrieve(ctx context.Context, cmd *cli.Command) er
8784
return err
8885
}
8986

90-
buildID := requestflag.CommandRequestValue[string](cmd, "build-id")
87+
buildID := cmd.Value("build-id").(string)
9188
if buildID == "" {
9289
latestBuild, err := getLatestBuild(ctx, client, cmd.String("project"), cmd.String("branch"))
9390
if err != nil {

pkg/cmd/flagoptions.go

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -101,36 +101,31 @@ func flagOptions(
101101
}
102102
}
103103

104-
// Only send request body if there's actual data
105-
if len(body) > 0 {
106-
107-
108104
switch bodyType {
109-
case MultipartFormEncoded:
110-
buf := new(bytes.Buffer)
111-
writer := multipart.NewWriter(buf)
112-
113-
// For multipart/form-encoded, we need a map structure
114-
bodyMap, ok := bodyData.(map[string]any)
115-
if !ok {
116-
return nil, fmt.Errorf("Cannot send a non-map value to a form-encoded endpoint: %v\n", bodyData)
117-
}
118-
if err := apiform.MarshalWithSettings(bodyMap, writer, apiform.FormatComma); err != nil {
119-
return nil, err
120-
}
121-
if err := writer.Close(); err != nil {
122-
return nil, err
123-
}
124-
options = append(options, option.WithRequestBody(writer.FormDataContentType(), buf))
125-
case ApplicationJSON:
126-
bodyBytes, err := json.Marshal(bodyData)
127-
if err != nil {
128-
return nil, err
129-
}
130-
options = append(options, option.WithRequestBody("application/json", bodyBytes))
131-
default:
132-
panic("Invalid body content type!")
105+
case MultipartFormEncoded:
106+
buf := new(bytes.Buffer)
107+
writer := multipart.NewWriter(buf)
108+
109+
// For multipart/form-encoded, we need a map structure
110+
bodyMap, ok := bodyData.(map[string]any)
111+
if !ok {
112+
return nil, fmt.Errorf("Cannot send a non-map value to a form-encoded endpoint: %v\n", bodyData)
113+
}
114+
if err := apiform.MarshalWithSettings(bodyMap, writer, apiform.FormatComma); err != nil {
115+
return nil, err
116+
}
117+
if err := writer.Close(); err != nil {
118+
return nil, err
119+
}
120+
options = append(options, option.WithRequestBody(writer.FormDataContentType(), buf))
121+
case ApplicationJSON:
122+
bodyBytes, err := json.Marshal(bodyData)
123+
if err != nil {
124+
return nil, err
133125
}
126+
options = append(options, option.WithRequestBody("application/json", bodyBytes))
127+
default:
128+
panic("Invalid body content type!")
134129
}
135130

136131
return options, nil

0 commit comments

Comments
 (0)