Skip to content

Commit

Permalink
Expand tilda
Browse files Browse the repository at this point in the history
  • Loading branch information
babarot committed Nov 27, 2017
1 parent 738b016 commit 4853ccc
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"os"
"path/filepath"
"strings"

homedir "github.com/mitchellh/go-homedir"
)

const (
Expand Down Expand Up @@ -34,16 +36,11 @@ func main() {
dir, _ := configDir()
json := filepath.Join(dir, "config.json")

err := cfg.LoadFile(json)
if err != nil {
if err := cfg.LoadFile(json); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}

credentials = os.Getenv(GoogleApplicationCredentials)
clientID = os.Getenv(IAPClientID)
binary = os.Getenv(IAPCurlBinary)

os.Exit(run(os.Args[1:]))
}

Expand Down Expand Up @@ -71,13 +68,11 @@ func run(args []string) int {
env, err := cfg.GetEnv(url)
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error())
for _, url := range cfg.SimilarURLs(url) {
}
fmt.Fprintf(os.Stderr, " similar urls found %q\n")
fmt.Fprintf(os.Stderr, " similar urls found %q\n", cfg.SimilarURLs(url))
return 1
}
if credentials == "" {
credentials = env.Credentials
credentials, _ = homedir.Expand(env.Credentials)
}
if clientID == "" {
clientID = env.ClientID
Expand Down

0 comments on commit 4853ccc

Please sign in to comment.