Skip to content

Commit

Permalink
Merge pull request #194 from WillAbides/npe-selected
Browse files Browse the repository at this point in the history
Fix panic running with no args
  • Loading branch information
WillAbides authored Dec 22, 2023
2 parents 1e12498 + 39defea commit 57546eb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/bindown/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ type rootCmd struct {
}

func (r *rootCmd) BeforeApply(k *kong.Context) error {
if k == nil || k.Selected() == nil {
return nil
}
// set dependency positional to optional for install, wrap, download and extract.
// We do this because we want to allow --all to be equivalent to specifying all
// dependencies but want the help output to indicate that a dependency is required.
Expand Down
2 changes: 2 additions & 0 deletions cmd/bindown/dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ dependencies:
runner := newCmdRunner(t)
srcFile := filepath.Join(runner.tmpDir, "template-source.yaml")
runner.writeConfigYaml(fmt.Sprintf(`
systems: ["linux/amd64", "darwin/amd64"]
url_checksums:
foo-linux-amd64-1.2.3: deadbeef
foo-darwin-amd64-1.2.3: deadbeef
Expand Down Expand Up @@ -436,6 +437,7 @@ dependencies:
runner := newCmdRunner(t)
srcFile := filepath.Join(runner.tmpDir, "template-source.yaml")
runner.writeConfigYaml(fmt.Sprintf(`
systems: ["linux/amd64", "darwin/amd64"]
url_checksums:
foo-linux-amd64-1.2.3: deadbeef
foo-darwin-amd64-1.2.3: deadbeef
Expand Down

0 comments on commit 57546eb

Please sign in to comment.