Quellcode durchsuchen

Add ability to add posts locally

pull/5/head
Matt Baer vor 9 Jahren
Ursprung
Commit
8a97dcd44a
2 geänderte Dateien mit 17 neuen und 0 gelöschten Zeilen
  1. +1
    -0
      README.md
  2. +16
    -0
      writeas/cli.go

+ 1
- 0
README.md Datei anzeigen

@@ -13,6 +13,7 @@ COMMANDS:
post Alias for default action: create post from stdin
delete Delete a post
get Read a raw post
add Add a post locally for easy modification
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:


+ 16
- 0
writeas/cli.go Datei anzeigen

@@ -97,6 +97,11 @@ func main() {
},
},
},
{
Name: "add",
Usage: "Add a post locally for easy modification",
Action: cmdAdd,
},
}

app.Run(os.Args)
@@ -202,6 +207,17 @@ func cmdGet(c *cli.Context) {
DoFetch(friendlyId, tor)
}

func cmdAdd(c *cli.Context) {
friendlyId := c.Args().Get(0)
token := c.Args().Get(1)
if friendlyId == "" || token == "" {
fmt.Println("usage: writeas add <postId> <token>")
os.Exit(1)
}

addPost(friendlyId, token)
}

func client(read, tor bool, path, query string) (string, *http.Client) {
var u *url.URL
var client *http.Client


Laden…
Abbrechen
Speichern