@@ -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
2321var version = "dev"
2422
2523var 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
4137type VersionCmd struct {}
@@ -54,16 +50,10 @@ func (c *VersionCmd) Run() error {
5450
5551// Run is the entrypoint for the CLI tool.
5652func 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
0 commit comments