Skip to content

Commit

Permalink
Merge pull request #13 from WillAbides/customcachedir
Browse files Browse the repository at this point in the history
set cellar-dir on the command line
  • Loading branch information
WillAbides authored Nov 4, 2019
2 parents f430152 + 219a4e5 commit 808fe56
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions cmd/bindownloader/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ import (
)

var kongVars = kong.Vars{
"arch_help": `download for this architecture`,
"arch_default": runtime.GOARCH,
"os_help": `download for this operating system`,
"os_default": runtime.GOOS,
"config_help": `file with tool definitions`,
"config_default": `buildtools.json`,
"force_help": `force download even if it already exists`,
"arch_help": `download for this architecture`,
"arch_default": runtime.GOARCH,
"os_help": `download for this operating system`,
"os_default": runtime.GOOS,
"config_help": `file with tool definitions`,
"config_default": `buildtools.json`,
"force_help": `force download even if it already exists`,
"cellar_dir_help": `directory where downloads will be cached`,
}

var cli struct {
Expand All @@ -25,6 +26,7 @@ var cli struct {
Config string `kong:"type=path,help=${config_help},default=${config_default}"`
Force bool `kong:"help=${force_help}"`
TargetFile string `kong:"arg,help='file to download'"`
CellarDir string `kong:"type=path,help=${cellar_dir_help}"`
}

func main() {
Expand All @@ -51,10 +53,13 @@ arch: %s
os.Exit(1)
}

err = downloader.Install(bindownloader.InstallOpts{
installOpts := bindownloader.InstallOpts{
TargetDir: binDir,
Force: cli.Force,
})
CellarDir: cli.CellarDir,
}

err = downloader.Install(installOpts)

kctx.FatalIfErrorf(err)
}

0 comments on commit 808fe56

Please sign in to comment.