Skip to content

Commit

Permalink
implemented link verification before opening new tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
farhadmak committed Oct 5, 2018
1 parent f072915 commit 820403c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions interfacer/src/browsh/browsh.go
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/base64"
"fmt"
"io/ioutil"
"net/url"
"os"
"os/exec"
"path/filepath"
Expand Down Expand Up @@ -191,9 +192,15 @@ func ttyEntry() {
// MainEntry decides between running Browsh as a CLI app or as an HTTP web server
func MainEntry() {
pflag.Parse()
if pflag.NArg() == 0 {
pflag.Usage()
os.Exit(1)
// validURL contains array of valid user inputted links.
var validURL []string
if pflag.NArg() != 0 {
for i := 0; i < len(pflag.Args()); i++ {
u, _ := url.ParseRequestURI(pflag.Args()[i])
if u != nil {
validURL = append(validURL, pflag.Args()[i])
}
}
}
Initialise()
if viper.GetBool("version") {
Expand Down

0 comments on commit 820403c

Please sign in to comment.