Skip to content

Commit

Permalink
Resolve issues with args.
Browse files Browse the repository at this point in the history
  • Loading branch information
a-h committed Sep 25, 2020
1 parent 109eab1 commit 2e1ef1c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ var defaultStyle = tcell.StyleDefault.
Background(tcell.ColorBlack)

func main() {
if strings.TrimLeft(os.Args[1], "-") == "version" {
if len(os.Args) > 1 && strings.TrimLeft(os.Args[1], "-") == "version" {
fmt.Println(version)
return
}
Expand Down Expand Up @@ -198,17 +198,16 @@ func main() {

// State.
state := &State{
URL: strings.Join(os.Args[1:], ""),
URL: conf.Home,
History: h,
Bookmarks: b,
Conf: conf,
Context: ctx,
}

// Use a URL passed via the command-line URL, if provided.
state.URL = strings.Join(os.Args[1:], "")
if state.URL == "" {
state.URL = conf.Home
if len(os.Args) > 1 {
state.URL = strings.Join(os.Args[1:], "")
}

// Create client.
Expand Down

0 comments on commit 2e1ef1c

Please sign in to comment.