Skip to content

Commit

Permalink
refactor(cmd.urlshc): precheck missing url opt
Browse files Browse the repository at this point in the history
  • Loading branch information
adhocore committed Apr 14, 2021
1 parent 7df6298 commit e9e13f8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions cmd/urlshc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bytes"
"errors"
"encoding/json"
"flag"
"fmt"
Expand Down Expand Up @@ -44,6 +45,10 @@ func input() (ureq.URLInput, error) {
flag.StringVar(&words, "keywords", "", "CSV keywords (optional, format: word-1,word2,word_3,...)")
flag.Parse()

if "" == i.URL {
return i, errors.New("url is required option")
}

if words != "" {
words = strings.ReplaceAll(words, ", ", ",")
words = strings.ReplaceAll(words, " ,", ",")
Expand Down

0 comments on commit e9e13f8

Please sign in to comment.