Skip to content

Commit 090bba6

Browse files
authored
Handle missing flags and correctly allow files in repos and validate commands (#675)
1 parent 964ebf1 commit 090bba6

3 files changed

Lines changed: 43 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ All notable changes to `src-cli` are documented in this file.
1919

2020
### Removed
2121

22+
## 3.35.2
23+
24+
### Fixed
25+
26+
- `src batch validate` and `src batch repos` now accept `-allow-unsupported` and `-force-override-ignore` and don't fail on specs using `files` anymore.
27+
2228
## 3.35.1
2329

2430
### Changed

cmd/src/batch_repositories.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,19 @@ Examples:
3636
apiFlags = api.NewFlags(flagSet)
3737
)
3838

39+
var (
40+
allowUnsupported bool
41+
allowIgnored bool
42+
)
43+
flagSet.BoolVar(
44+
&allowUnsupported, "allow-unsupported", false,
45+
"Allow unsupported code hosts.",
46+
)
47+
flagSet.BoolVar(
48+
&allowIgnored, "force-override-ignore", false,
49+
"Do not ignore repositories that have a .batchignore file.",
50+
)
51+
3952
handler := func(args []string) error {
4053
if err := flagSet.Parse(args); err != nil {
4154
return err
@@ -44,7 +57,12 @@ Examples:
4457
ctx := context.Background()
4558
client := cfg.apiClient(apiFlags, flagSet.Output())
4659

47-
svc := service.New(&service.Opts{Client: client})
60+
svc := service.New(&service.Opts{
61+
Client: client,
62+
AllowUnsupported: allowUnsupported,
63+
AllowIgnored: allowIgnored,
64+
AllowFiles: true,
65+
})
4866

4967
if err := svc.DetermineFeatureFlags(ctx); err != nil {
5068
return err

cmd/src/batch_validate.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77

88
"github.com/sourcegraph/sourcegraph/lib/output"
9+
910
"github.com/sourcegraph/src-cli/internal/api"
1011
"github.com/sourcegraph/src-cli/internal/batches/service"
1112
"github.com/sourcegraph/src-cli/internal/batches/ui"
@@ -30,6 +31,19 @@ Examples:
3031
apiFlags := api.NewFlags(flagSet)
3132
fileFlag := flagSet.String("f", "", "The batch spec file to read.")
3233

34+
var (
35+
allowUnsupported bool
36+
allowIgnored bool
37+
)
38+
flagSet.BoolVar(
39+
&allowUnsupported, "allow-unsupported", false,
40+
"Allow unsupported code hosts.",
41+
)
42+
flagSet.BoolVar(
43+
&allowIgnored, "force-override-ignore", false,
44+
"Do not ignore repositories that have a .batchignore file.",
45+
)
46+
3347
handler := func(args []string) error {
3448
ctx := context.Background()
3549

@@ -44,7 +58,10 @@ Examples:
4458
out := output.NewOutput(flagSet.Output(), output.OutputOpts{Verbose: *verbose})
4559
ui := &ui.TUI{Out: out}
4660
svc := service.New(&service.Opts{
47-
Client: cfg.apiClient(apiFlags, flagSet.Output()),
61+
Client: cfg.apiClient(apiFlags, flagSet.Output()),
62+
AllowUnsupported: allowUnsupported,
63+
AllowIgnored: allowIgnored,
64+
AllowFiles: true,
4865
})
4966

5067
if err := svc.DetermineFeatureFlags(ctx); err != nil {

0 commit comments

Comments
 (0)