Skip to content

Commit c8ac149

Browse files
authored
Revert "feat: adds bash autocompletions (#72)" (#74)
This reverts commit 5131d0f.
1 parent 5131d0f commit c8ac149

File tree

11 files changed

+22
-57
lines changed

11 files changed

+22
-57
lines changed

cli/cmd/cmds/ci.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
type CICmd struct {
99
Artifact string `short:"a" help:"Dump all produced artifacts to the given path."`
10-
Path string `kong:"arg,predictor=path" default:"" help:"The path to scan from."`
10+
Path string `arg:"" default:"" help:"The path to scan from."`
1111
Platform []string `short:"p" help:"Run the target with the given platform."`
1212
}
1313

cli/cmd/cmds/deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
)
99

1010
type DeployCmd struct {
11-
Project string `arg:"" help:"The path to the project to deploy." kong:"arg,predictor=path"`
11+
Project string `arg:"" help:"The path to the project to deploy."`
1212
}
1313

1414
func (c *DeployCmd) Run(ctx run.RunContext) error {

cli/cmd/cmds/dump.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
type DumpCmd struct {
10-
Project string `arg:"" help:"Path to the project." kong:"arg,predictor=path"`
10+
Project string `arg:"" help:"Path to the project."`
1111
Pretty bool `help:"Pretty print JSON output."`
1212
}
1313

cli/cmd/cmds/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
type RunCmd struct {
99
Artifact string `short:"a" help:"Dump all produced artifacts to the given path."`
10-
Path string `kong:"arg,predictor=path" help:"The path to the target to execute (i.e., ./dir1+test)."`
10+
Path string `arg:"" help:"The path to the target to execute (i.e., ./dir1+test)."`
1111
Platform []string `short:"p" help:"Run the target with the given platform."`
1212
Pretty bool `help:"Pretty print JSON output."`
1313
TargetArgs []string `arg:"" help:"Arguments to pass to the target." default:""`

cli/cmd/cmds/scan.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type ScanCmd struct {
1818
Earthfile bool `help:"Return the Earthfile targets for each project."`
1919
Filter []string `short:"f" help:"Filter Earthfile targets by regular expression or blueprint results by path."`
2020
Pretty bool `help:"Pretty print JSON output."`
21-
RootPath string `kong:"arg,predictor=path" help:"Root path to scan for Earthfiles and their respective targets."`
21+
RootPath string `arg:"" help:"Root path to scan for Earthfiles and their respective targets."`
2222
}
2323

2424
func (c *ScanCmd) Run(ctx run.RunContext) error {

cli/cmd/cmds/secret.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ type Get struct {
1919
Key string `short:"k" help:"The key inside of the secret to get."`
2020
Project string `help:"Path to a project to use for getting secret configuration."`
2121
Provider string `short:"p" help:"The provider of the secret store." default:"aws"`
22-
Path string `kong:"arg,predictor=path" help:"The path to the secret (or path in a project blueprint if --project is specified)."`
22+
Path string `arg:"" help:"The path to the secret (or path in a project blueprint if --project is specified)."`
2323
}
2424

2525
type Set struct {
2626
Field []string `short:"f" help:"A secret field to set."`
2727
Provider string `short:"p" help:"The provider of the secret store." default:"aws"`
28-
Path string `kong:"arg,predictor=path" help:"The path to the secret (or path in a project blueprint if --project is specified)."`
28+
Path string `arg:"" help:"The path to the secret (or path in a project blueprint if --project is specified)."`
2929
Project string `help:"Path to a project to use for getting secret configuration."`
3030
Value string `arg:"" help:"The value to set." default:""`
3131
}

cli/cmd/cmds/tag.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
type TagCmd struct {
1111
Pretty bool `short:"p" help:"Pretty print JSON output."`
12-
Project string `kong:"arg,predictor=path" help:"The project to generate tags for."`
12+
Project string `arg:"" help:"The project to generate tags for."`
1313
Trim bool `short:"t" help:"Trim the project path from the git tag."`
1414
}
1515

cli/cmd/cmds/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
)
66

77
type ValidateCmd struct {
8-
Project string `kong:"arg,predictor=path" help:"Path to the project."`
8+
Project string `arg:"" help:"Path to the project."`
99
}
1010

1111
func (c *ValidateCmd) Run(ctx run.RunContext) error {

cli/cmd/main.go

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,22 @@ import (
1616
"github.com/input-output-hk/catalyst-forge/lib/project/schema"
1717
"github.com/input-output-hk/catalyst-forge/lib/project/secrets"
1818
"github.com/input-output-hk/catalyst-forge/lib/tools/walker"
19-
"github.com/posener/complete"
20-
"github.com/willabides/kongplete"
2119
)
2220

2321
var version = "dev"
2422

2523
var cli struct {
2624
cmds.GlobalArgs
2725

28-
Deploy cmds.DeployCmd `kong:"cmd" help:"Deploy a project." `
29-
Dump cmds.DumpCmd `kong:"cmd" help:"Dumps a project's blueprint to JSON."`
30-
CI cmds.CICmd `kong:"cmd" help:"Simulate a CI run."`
31-
Run cmds.RunCmd `kong:"cmd" help:"Run an Earthly target."`
32-
Scan cmds.ScanCmd `kong:"cmd" help:"Scan for Earthfiles."`
33-
Secret cmds.SecretCmd `kong:"cmd" help:"Manage secrets."`
34-
Tag cmds.TagCmd `kong:"cmd" help:"Generate a tag for a project."`
35-
Validate cmds.ValidateCmd `kong:"cmd" help:"Validates a project."`
36-
Version VersionCmd `kong:"cmd" help:"Print the version."`
37-
38-
InstallCompletions kongplete.InstallCompletions `cmd:"" help:"install shell completions"`
26+
Deploy cmds.DeployCmd `cmd:"" help:"Deploy a project."`
27+
Dump cmds.DumpCmd `cmd:"" help:"Dumps a project's blueprint to JSON."`
28+
CI cmds.CICmd `cmd:"" help:"Simulate a CI run."`
29+
Run cmds.RunCmd `cmd:"" help:"Run an Earthly target."`
30+
Scan cmds.ScanCmd `cmd:"" help:"Scan for Earthfiles."`
31+
Secret cmds.SecretCmd `cmd:"" help:"Manage secrets."`
32+
Tag cmds.TagCmd `cmd:"" help:"Generate a tag for a project."`
33+
Validate cmds.ValidateCmd `cmd:"" help:"Validates a project."`
34+
Version VersionCmd `cmd:"" help:"Print the version."`
3935
}
4036

4137
type VersionCmd struct{}
@@ -54,16 +50,10 @@ func (c *VersionCmd) Run() error {
5450

5551
// Run is the entrypoint for the CLI tool.
5652
func Run() int {
57-
cliArgs := os.Args[1:]
58-
59-
parser := kong.Must(&cli,
53+
ctx := kong.Parse(&cli,
6054
kong.Name("forge"),
6155
kong.Description("The CLI tool powering Catalyst Forge"))
6256

63-
kongplete.Complete(parser,
64-
kongplete.WithPredictor("path", complete.PredictFiles("*")),
65-
)
66-
6757
handler := log.New(os.Stderr)
6858
switch cli.Verbose {
6959
case 0:
@@ -76,12 +66,6 @@ func Run() int {
7666
handler.SetLevel(log.DebugLevel)
7767
}
7868

79-
ctx, err := parser.Parse(cliArgs)
80-
if err != nil {
81-
fmt.Fprintf(os.Stderr, "forge: %v\n", err)
82-
return 1
83-
}
84-
8569
logger := slog.New(handler)
8670
loader := project.NewDefaultProjectLoader(logger)
8771
runctx := run.RunContext{
@@ -99,8 +83,9 @@ func Run() int {
9983
}
10084
ctx.Bind(runctx)
10185

102-
if err := ctx.Run(); err != nil {
103-
fmt.Fprintf(os.Stderr, "forge: %v\n", err)
86+
err := ctx.Run()
87+
if err != nil {
88+
fmt.Fprintf(os.Stderr, "forge: %v", err)
10489
return 1
10590
}
10691

cli/go.mod

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,9 @@ require (
1313
github.com/go-git/go-git/v5 v5.12.0
1414
github.com/input-output-hk/catalyst-forge/lib/project v0.0.0
1515
github.com/input-output-hk/catalyst-forge/lib/tools v0.0.0
16-
github.com/posener/complete v1.2.3
1716
github.com/rogpeppe/go-internal v1.12.1-0.20240709150035-ccf4b4329d21
1817
github.com/spf13/afero v1.11.0
1918
github.com/stretchr/testify v1.9.0
20-
github.com/willabides/kongplete v0.4.0
21-
github.com/yuin/goldmark v1.7.4
2219
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
2320
)
2421

@@ -57,8 +54,6 @@ require (
5754
github.com/go-logfmt/logfmt v0.6.0 // indirect
5855
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
5956
github.com/google/uuid v1.6.0 // indirect
60-
github.com/hashicorp/errwrap v1.1.0 // indirect
61-
github.com/hashicorp/go-multierror v1.1.1 // indirect
6257
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
6358
github.com/kevinburke/ssh_config v1.2.0 // indirect
6459
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
@@ -72,7 +67,6 @@ require (
7267
github.com/pkg/errors v0.9.1 // indirect
7368
github.com/pmezard/go-difflib v1.0.0 // indirect
7469
github.com/rivo/uniseg v0.4.7 // indirect
75-
github.com/riywo/loginshell v0.0.0-20200815045211-7d26008be1ab // indirect
7670
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
7771
github.com/skeema/knownhosts v1.2.2 // indirect
7872
github.com/xanzy/ssh-agent v0.3.3 // indirect

0 commit comments

Comments
 (0)