Skip to content

Commit

Permalink
feat: rearrange functions to files
Browse files Browse the repository at this point in the history
- private functions to helpers
- public functions to gobrew
- use os variables only on main function
- setup gobrew with one function
  • Loading branch information
juev committed Dec 9, 2023
1 parent 394402c commit 400b4a6
Show file tree
Hide file tree
Showing 5 changed files with 568 additions and 601 deletions.
10 changes: 9 additions & 1 deletion cmd/gobrew/main.go
Expand Up @@ -8,6 +8,7 @@ import (
"strings"

"github.com/kevincobain2000/gobrew"
"github.com/kevincobain2000/gobrew/utils"
)

var args []string
Expand Down Expand Up @@ -73,7 +74,14 @@ func init() {
}

func main() {
gb := gobrew.NewGoBrew()
homeDir, ok := os.LookupEnv("GOBREW_ROOT")
if !ok {
var err error
homeDir, err = os.UserHomeDir()
utils.CheckError(err, "failed get home directory and GOBREW_ROOT not defined")
}

gb := gobrew.NewGoBrew(homeDir)
switch actionArg {
case "interactive", "info":
gb.Interactive(true)
Expand Down

0 comments on commit 400b4a6

Please sign in to comment.