From 7e8b0f8b1cf249447e35ce0cf01acd8017d54597 Mon Sep 17 00:00:00 2001 From: Nik Ogura Date: Sat, 9 Feb 2019 18:16:35 -0800 Subject: [PATCH] fixed offline mode --- cmd/dbt/main.go | 13 ++++++++++--- metadata.json | 2 +- pkg/dbt/dbt.go | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cmd/dbt/main.go b/cmd/dbt/main.go index d2b7a3c..e522e71 100644 --- a/cmd/dbt/main.go +++ b/cmd/dbt/main.go @@ -12,7 +12,7 @@ import ( const DBT = "/usr/local/bin/dbt" // VERSION the version of dbt. Must match version in metadata.json -const VERSION = "2.1.12" +const VERSION = "2.1.13" // there are only two options for dbt itself, 'version' and 'offline' var version string @@ -67,9 +67,10 @@ func main() { } if len(args) > 0 { - possibles = []string{"-v", "-ov"} + versionPossibles := []string{"-v", "-ov"} + offlinePossibles := []string{"-o"} - if dbt.StringInSlice(args[0], possibles) { + if dbt.StringInSlice(args[0], versionPossibles) { if len(args) > 2 { version = args[1] @@ -81,6 +82,12 @@ func main() { } else { log.Fatalf("-v flag requires a version.") } + + } else if dbt.StringInSlice(args[0], offlinePossibles) { + err = dbtObj.RunTool(version, args[1:], homedir, offline) + if err != nil { + log.Fatalf("Error running tool: %s", err) + } } else { err = dbtObj.RunTool(version, args, homedir, offline) if err != nil { diff --git a/metadata.json b/metadata.json index 07e6113..3edff24 100644 --- a/metadata.json +++ b/metadata.json @@ -1,5 +1,5 @@ { - "version": "2.1.12", + "version": "2.1.13", "package": "github.com/nikogura/dbt", "description": "Dynamic Binary Toolkit - A framework for running self-updating signed binaries from a central, trusted repository.", "repository": "http://localhost:8081/artifactory/dbt", diff --git a/pkg/dbt/dbt.go b/pkg/dbt/dbt.go index 3ffdf38..064a3be 100644 --- a/pkg/dbt/dbt.go +++ b/pkg/dbt/dbt.go @@ -203,7 +203,7 @@ func (dbt *DBT) FetchTrustStore(homedir string, verbose bool) (err error) { return err } -// IsCurrent returns whether the currently running version is the latest version, and possibly an error if the version check failes +// IsCurrent returns whether the currently running version is the latest version, and possibly an error if the version check fails func (dbt *DBT) IsCurrent(binaryPath string) (ok bool, err error) { if binaryPath == "" { binaryPath = DbtBinaryPath