Add post query skeleton

This commit is contained in:
Mikhail Klementyev 2016-08-01 03:11:48 +03:00
parent 4a4d10c760
commit 0e256f04a6
2 changed files with 10 additions and 0 deletions

View File

@ -139,6 +139,10 @@ func Get(db *sql.DB, linkUrl string) {
fmt.Println(text) fmt.Println(text)
} }
func Post(db *sql.DB, formID int64, formArgs []string) {
fmt.Println("Not implemented")
}
func Link(db *sql.DB, linkID int64, fromHistory bool) { func Link(db *sql.DB, linkID int64, fromHistory bool) {
var linkUrl string var linkUrl string

View File

@ -42,6 +42,10 @@ var (
get = kingpin.Command("get", "Get url") get = kingpin.Command("get", "Get url")
getUrl = get.Arg("url", "Url").Required().String() getUrl = get.Arg("url", "Url").Required().String()
post = kingpin.Command("post", "Fill post form")
postID = post.Arg("id", "Form ID").Required().Int64()
postArgs = SearchList(post.Arg("args", "Post form arguments"))
link = kingpin.Command("link", "Get link") link = kingpin.Command("link", "Get link")
linkNo = link.Arg("no", "Number").Required().Int64() linkNo = link.Arg("no", "Number").Required().Int64()
linkFromHistory = link.Flag("history", "Item from history").Bool() linkFromHistory = link.Flag("history", "Item from history").Bool()
@ -64,6 +68,8 @@ func main() {
switch kingpin.Parse() { switch kingpin.Parse() {
case "get": case "get":
commands.Get(db, *getUrl) commands.Get(db, *getUrl)
case "post":
commands.Post(db, *postID, *postArgs)
case "link": case "link":
commands.Link(db, *linkNo, *linkFromHistory) commands.Link(db, *linkNo, *linkFromHistory)
case "history": case "history":