Skip to content

Commit d6af393

Browse files
stainless-app[bot]yjp20
authored andcommitted
feat: arguments now have defaults and descriptions
1 parent 6ae9059 commit d6af393

File tree

8 files changed

+124
-67
lines changed

8 files changed

+124
-67
lines changed

pkg/cmd/build.go

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,16 @@ var buildsCreate = cli.Command{
228228
Usage: "Create a build, on top of a project branch, against a given input revision.",
229229
Flags: []cli.Flag{
230230
&jsonflag.JSONStringFlag{
231-
Name: "project",
231+
Name: "project",
232+
Usage: "Project name",
232233
Config: jsonflag.JSONConfig{
233234
Kind: jsonflag.Body,
234235
Path: "project",
235236
},
236237
},
237238
&jsonflag.JSONStringFlag{
238-
Name: "revision",
239+
Name: "revision",
240+
Usage: `A branch name, commit SHA, or merge command in the format "base..head"`,
239241
Config: jsonflag.JSONConfig{
240242
Kind: jsonflag.Body,
241243
Path: "revision",
@@ -260,29 +262,34 @@ var buildsCreate = cli.Command{
260262
Usage: "Pull the build outputs after completion (only works with --wait)",
261263
},
262264
&jsonflag.JSONBoolFlag{
263-
Name: "allow-empty",
265+
Name: "allow-empty",
266+
Usage: "Whether to allow empty commits (no changes). Defaults to false.",
264267
Config: jsonflag.JSONConfig{
265268
Kind: jsonflag.Body,
266269
Path: "allow_empty",
267270
SetValue: true,
268271
},
272+
Value: false,
269273
},
270274
&jsonflag.JSONStringFlag{
271-
Name: "branch",
275+
Name: "branch",
276+
Usage: "The project branch to use for the build. If not specified, the\nbranch is inferred from the `revision`, and will 400 when that\nis not possible.",
272277
Config: jsonflag.JSONConfig{
273278
Kind: jsonflag.Body,
274279
Path: "branch",
275280
},
276281
},
277282
&jsonflag.JSONStringFlag{
278-
Name: "commit-message",
283+
Name: "commit-message",
284+
Usage: "Optional commit message to use when creating a new commit.",
279285
Config: jsonflag.JSONConfig{
280286
Kind: jsonflag.Body,
281287
Path: "commit_message",
282288
},
283289
},
284290
&jsonflag.JSONStringFlag{
285-
Name: "targets",
291+
Name: "targets",
292+
Usage: "Optional list of SDK targets to build. If not specified, all configured\ntargets will be built.",
286293
Config: jsonflag.JSONConfig{
287294
Kind: jsonflag.Body,
288295
Path: "targets.#",
@@ -297,7 +304,8 @@ var buildsCreate = cli.Command{
297304
Hidden: true,
298305
},
299306
&jsonflag.JSONStringFlag{
300-
Name: "+target",
307+
Name: "+target",
308+
Usage: "Optional list of SDK targets to build. If not specified, all configured\ntargets will be built.",
301309
Config: jsonflag.JSONConfig{
302310
Kind: jsonflag.Body,
303311
Path: "targets.-1",
@@ -313,7 +321,8 @@ var buildsRetrieve = cli.Command{
313321
Usage: "Retrieve a build by its ID.",
314322
Flags: []cli.Flag{
315323
&cli.StringFlag{
316-
Name: "build-id",
324+
Name: "build-id",
325+
Usage: "Build ID",
317326
},
318327
},
319328
Action: handleBuildsRetrieve,
@@ -325,35 +334,41 @@ var buildsList = cli.Command{
325334
Usage: "List user-triggered builds for a given project.",
326335
Flags: []cli.Flag{
327336
&jsonflag.JSONStringFlag{
328-
Name: "project",
337+
Name: "project",
338+
Usage: "Project name",
329339
Config: jsonflag.JSONConfig{
330340
Kind: jsonflag.Query,
331341
Path: "project",
332342
},
333343
},
334344
&jsonflag.JSONStringFlag{
335-
Name: "branch",
345+
Name: "branch",
346+
Usage: "Branch name",
336347
Config: jsonflag.JSONConfig{
337348
Kind: jsonflag.Query,
338349
Path: "branch",
339350
},
340351
},
341352
&jsonflag.JSONStringFlag{
342-
Name: "cursor",
353+
Name: "cursor",
354+
Usage: "Pagination cursor from a previous response.",
343355
Config: jsonflag.JSONConfig{
344356
Kind: jsonflag.Query,
345357
Path: "cursor",
346358
},
347359
},
348360
&jsonflag.JSONFloatFlag{
349-
Name: "limit",
361+
Name: "limit",
362+
Usage: "Maximum number of builds to return, defaults to 10 (maximum: 100).",
350363
Config: jsonflag.JSONConfig{
351364
Kind: jsonflag.Query,
352365
Path: "limit",
353366
},
367+
Value: 10,
354368
},
355369
&jsonflag.JSONStringFlag{
356-
Name: "revision",
370+
Name: "revision",
371+
Usage: "A config commit SHA used for the build",
357372
Config: jsonflag.JSONConfig{
358373
Kind: jsonflag.Query,
359374
Path: "revision",
@@ -369,63 +384,72 @@ var buildsCompare = cli.Command{
369384
Usage: "Create two builds whose outputs can be directly compared with each other.",
370385
Flags: []cli.Flag{
371386
&jsonflag.JSONStringFlag{
372-
Name: "base.branch",
387+
Name: "base.branch",
388+
Usage: "Branch to use. When using a branch name as revision, this must match or be\nomitted.",
373389
Config: jsonflag.JSONConfig{
374390
Kind: jsonflag.Body,
375391
Path: "base.branch",
376392
},
377393
},
378394
&jsonflag.JSONStringFlag{
379-
Name: "base.revision",
395+
Name: "base.revision",
396+
Usage: `A branch name, commit SHA, or merge command in the format "base..head"`,
380397
Config: jsonflag.JSONConfig{
381398
Kind: jsonflag.Body,
382399
Path: "base.revision",
383400
},
384401
},
385402
&jsonflag.JSONStringFlag{
386-
Name: "base.commit_message",
403+
Name: "base.commit_message",
404+
Usage: "Optional commit message to use when creating a new commit.",
387405
Config: jsonflag.JSONConfig{
388406
Kind: jsonflag.Body,
389407
Path: "base.commit_message",
390408
},
391409
},
392410
&jsonflag.JSONStringFlag{
393-
Name: "head.branch",
411+
Name: "head.branch",
412+
Usage: "Branch to use. When using a branch name as revision, this must match or be\nomitted.",
394413
Config: jsonflag.JSONConfig{
395414
Kind: jsonflag.Body,
396415
Path: "head.branch",
397416
},
398417
},
399418
&jsonflag.JSONStringFlag{
400-
Name: "head.revision",
419+
Name: "head.revision",
420+
Usage: `A branch name, commit SHA, or merge command in the format "base..head"`,
401421
Config: jsonflag.JSONConfig{
402422
Kind: jsonflag.Body,
403423
Path: "head.revision",
404424
},
405425
},
406426
&jsonflag.JSONStringFlag{
407-
Name: "head.commit_message",
427+
Name: "head.commit_message",
428+
Usage: "Optional commit message to use when creating a new commit.",
408429
Config: jsonflag.JSONConfig{
409430
Kind: jsonflag.Body,
410431
Path: "head.commit_message",
411432
},
412433
},
413434
&jsonflag.JSONStringFlag{
414-
Name: "project",
435+
Name: "project",
436+
Usage: "Project name",
415437
Config: jsonflag.JSONConfig{
416438
Kind: jsonflag.Body,
417439
Path: "project",
418440
},
419441
},
420442
&jsonflag.JSONStringFlag{
421-
Name: "targets",
443+
Name: "targets",
444+
Usage: "Optional list of SDK targets to build. If not specified, all configured\ntargets will be built.",
422445
Config: jsonflag.JSONConfig{
423446
Kind: jsonflag.Body,
424447
Path: "targets.#",
425448
},
426449
},
427450
&jsonflag.JSONStringFlag{
428-
Name: "+target",
451+
Name: "+target",
452+
Usage: "Optional list of SDK targets to build. If not specified, all configured\ntargets will be built.",
429453
Config: jsonflag.JSONConfig{
430454
Kind: jsonflag.Body,
431455
Path: "targets.-1",
@@ -436,7 +460,7 @@ var buildsCompare = cli.Command{
436460
HideHelpCommand: true,
437461
}
438462

439-
func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
463+
func handleBuildsCreate(_ context.Context, cmd *cli.Command) error {
440464
cc := getAPICommandContext(cmd)
441465
unusedArgs := cmd.Args().Slice()
442466
if len(unusedArgs) > 0 {
@@ -493,7 +517,7 @@ func handleBuildsCreate(ctx context.Context, cmd *cli.Command) error {
493517
return ShowJSON("builds create", data, format, transform)
494518
}
495519

496-
func handleBuildsRetrieve(ctx context.Context, cmd *cli.Command) error {
520+
func handleBuildsRetrieve(_ context.Context, cmd *cli.Command) error {
497521
cc := getAPICommandContext(cmd)
498522
unusedArgs := cmd.Args().Slice()
499523
if !cmd.IsSet("build-id") && len(unusedArgs) > 0 {
@@ -789,7 +813,7 @@ func pullOutput(output, url, ref, targetDir string, targetGroup *Group) error {
789813
return nil
790814
}
791815

792-
func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
816+
func handleBuildsList(_ context.Context, cmd *cli.Command) error {
793817
cc := getAPICommandContext(cmd)
794818
unusedArgs := cmd.Args().Slice()
795819
if len(unusedArgs) > 0 {
@@ -813,7 +837,7 @@ func handleBuildsList(ctx context.Context, cmd *cli.Command) error {
813837
return ShowJSON("builds list", json, format, transform)
814838
}
815839

816-
func handleBuildsCompare(ctx context.Context, cmd *cli.Command) error {
840+
func handleBuildsCompare(_ context.Context, cmd *cli.Command) error {
817841
cc := getAPICommandContext(cmd)
818842
unusedArgs := cmd.Args().Slice()
819843
if len(unusedArgs) > 0 {

pkg/cmd/builddiagnostic.go

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,45 @@ var buildsDiagnosticsList = cli.Command{
1818
Usage: "Get the list of diagnostics for a given build.",
1919
Flags: []cli.Flag{
2020
&cli.StringFlag{
21-
Name: "build-id",
21+
Name: "build-id",
22+
Usage: "Build ID",
2223
},
2324
&jsonflag.JSONStringFlag{
24-
Name: "cursor",
25+
Name: "cursor",
26+
Usage: "Pagination cursor from a previous response",
2527
Config: jsonflag.JSONConfig{
2628
Kind: jsonflag.Query,
2729
Path: "cursor",
2830
},
2931
},
3032
&jsonflag.JSONFloatFlag{
31-
Name: "limit",
33+
Name: "limit",
34+
Usage: "Maximum number of diagnostics to return, defaults to 100 (maximum: 100)",
3235
Config: jsonflag.JSONConfig{
3336
Kind: jsonflag.Query,
3437
Path: "limit",
3538
},
39+
Value: 100,
3640
},
3741
&jsonflag.JSONStringFlag{
38-
Name: "severity",
42+
Name: "severity",
43+
Usage: "Includes the given severity and above (fatal > error > warning > note).",
3944
Config: jsonflag.JSONConfig{
4045
Kind: jsonflag.Query,
4146
Path: "severity",
4247
},
4348
},
4449
&jsonflag.JSONStringFlag{
45-
Name: "targets",
50+
Name: "targets",
51+
Usage: "Optional list of language targets to filter diagnostics by",
4652
Config: jsonflag.JSONConfig{
4753
Kind: jsonflag.Query,
4854
Path: "targets.#",
4955
},
5056
},
5157
&jsonflag.JSONStringFlag{
52-
Name: "+target",
58+
Name: "+target",
59+
Usage: "Optional list of language targets to filter diagnostics by",
5360
Config: jsonflag.JSONConfig{
5461
Kind: jsonflag.Query,
5562
Path: "targets.-1",
@@ -60,7 +67,7 @@ var buildsDiagnosticsList = cli.Command{
6067
HideHelpCommand: true,
6168
}
6269

63-
func handleBuildsDiagnosticsList(ctx context.Context, cmd *cli.Command) error {
70+
func handleBuildsDiagnosticsList(_ context.Context, cmd *cli.Command) error {
6471
cc := getAPICommandContext(cmd)
6572
unusedArgs := cmd.Args().Slice()
6673
if !cmd.IsSet("build-id") && len(unusedArgs) > 0 {

pkg/cmd/buildtargetoutput.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ var buildsTargetOutputsRetrieve = cli.Command{
2121
Name: "pull",
2222
},
2323
&jsonflag.JSONStringFlag{
24-
Name: "build-id",
24+
Name: "build-id",
25+
Usage: "Build ID",
2526
Config: jsonflag.JSONConfig{
2627
Kind: jsonflag.Query,
2728
Path: "build_id",
@@ -37,7 +38,8 @@ var buildsTargetOutputsRetrieve = cli.Command{
3738
Value: "main",
3839
},
3940
&jsonflag.JSONStringFlag{
40-
Name: "target",
41+
Name: "target",
42+
Usage: "SDK language target name",
4143
Config: jsonflag.JSONConfig{
4244
Kind: jsonflag.Query,
4345
Path: "target",
@@ -51,17 +53,19 @@ var buildsTargetOutputsRetrieve = cli.Command{
5153
},
5254
},
5355
&jsonflag.JSONStringFlag{
54-
Name: "output",
56+
Name: "output",
57+
Usage: "Output format: url (download URL) or git (temporary access token).",
5558
Config: jsonflag.JSONConfig{
5659
Kind: jsonflag.Query,
5760
Path: "output",
5861
},
62+
Value: "url",
5963
},
6064
},
6165
Action: handleBuildsTargetOutputsRetrieve,
6266
}
6367

64-
func handleBuildsTargetOutputsRetrieve(ctx context.Context, cmd *cli.Command) error {
68+
func handleBuildsTargetOutputsRetrieve(_ context.Context, cmd *cli.Command) error {
6569
cc := getAPICommandContext(cmd)
6670
unusedArgs := cmd.Args().Slice()
6771
if len(unusedArgs) > 0 {

pkg/cmd/org.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var orgsList = cli.Command{
3131
HideHelpCommand: true,
3232
}
3333

34-
func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error {
34+
func handleOrgsRetrieve(_ context.Context, cmd *cli.Command) error {
3535
cc := getAPICommandContext(cmd)
3636
unusedArgs := cmd.Args().Slice()
3737
if !cmd.IsSet("org") && len(unusedArgs) > 0 {
@@ -58,7 +58,7 @@ func handleOrgsRetrieve(ctx context.Context, cmd *cli.Command) error {
5858
return ShowJSON("orgs retrieve", json, format, transform)
5959
}
6060

61-
func handleOrgsList(ctx context.Context, cmd *cli.Command) error {
61+
func handleOrgsList(_ context.Context, cmd *cli.Command) error {
6262
cc := getAPICommandContext(cmd)
6363
unusedArgs := cmd.Args().Slice()
6464
if len(unusedArgs) > 0 {

0 commit comments

Comments
 (0)