From 4d7494a1c3463d1b6e850ca1f560a56d1951ad3d Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Fri, 20 Sep 2019 14:24:38 -0400 Subject: [PATCH] Split up READMEs and GUIDEs for writeas-cli and wf-cli. --- GUIDE.md | 156 ++--------------------------------------------- README.md | 96 ++++++----------------------- cmd/wf/GUIDE.md | 164 ++++++++++++++++++++++++++++++++++++++++++++++++++ cmd/wf/README.md | 109 +++++++++++++++++++++++++++++++++ cmd/writeas/GUIDE.md | 149 +++++++++++++++++++++++++++++++++++++++++++++ cmd/writeas/README.md | 109 +++++++++++++++++++++++++++++++++ 6 files changed, 555 insertions(+), 228 deletions(-) create mode 100644 cmd/wf/GUIDE.md create mode 100644 cmd/wf/README.md create mode 100644 cmd/writeas/GUIDE.md create mode 100644 cmd/writeas/README.md diff --git a/GUIDE.md b/GUIDE.md index 68d29d1..a385e3a 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -1,153 +1,9 @@ -# Write.as CLI User Guide +# Write.as / WriteFreely CLI User Guide -The Write.as Command-Line Interface (CLI) is a cross-platform tool for publishing text to [Write.as](https://write.as) and its other sites, like [Paste.as](https://paste.as). It is designed to be simple, scriptable, do one job (publishing) well, and work as you'd expect with other command-line tools. +**This has been split into two user guides:** -Write.as is a text-publishing service that protects your privacy. There's no sign up required to publish, but if you do sign up, you can access posts across devices and compile collections of them in what most people would call a "blog". +## Write.as CLI +See full usage documentation on our [writeas-cli User Guide](https://github.com/writeas/writeas-cli/blob/master/cmd/writeas/GUIDE.md). -## Uses - -These are a few common uses for `writeas`. If you get stuck or want to know more, run `writeas [command] --help`. If you still have questions, [ask us](https://write.as/contact). - -### Overview - -``` - writeas [global options] command [command options] [arguments...] - -COMMANDS: - post Alias for default action: create post from stdin - new Compose a new post from the command-line and publish - publish Publish a file to Write.as - delete Delete a post - update Update (overwrite) a post - get Read a raw post - add Add an existing post locally - posts List all of your posts - claim Claim local unsynced posts - blogs List blogs - claim Claim local unsynced posts - auth Authenticate with Write.as - logout Log out of Write.as - help, h Shows a list of commands or help for one command - -GLOBAL OPTIONS: - -c value, -b value Optional blog to post to - --tor, -t Perform action on Tor hidden service - --tor-port value Use a different port to connect to Tor (default: 9150) - --code Specifies this post is code - --md Returns post URL with Markdown enabled - --verbose, -v Make the operation more talkative - --font value Sets post font to given value (default: "mono") - --lang value Sets post language to given ISO 639-1 language code - --user-agent value Sets the User-Agent for API requests - --host value, -H value Operate against a custom hostname - --user value, -u value Use authenticated user, other than default - --help, -h show help - --version, -V print the version -``` - -> Note: the host and user flags are only available in `writefreely`. - -#### Share something - -By default, `writeas` creates a post with a `monospace` typeface that doesn't word wrap (scrolls horizontally). It will return a single line with a URL, and automatically copy that URL to the clipboard: - -```bash -$ echo "Hello world!" | writeas -https://write.as/aaaazzzzzzzza -``` - -This is generally more useful for posting terminal output or code, like so (the `--code` flag turns on syntax highlighting): - -macOS / Linux: `cat writeas/cli.go | writeas --code` - -Windows: `type writeas/cli.go | writeas.exe --code` - -#### Output a post - -This outputs any Write.as post with the given ID. - -```bash -$ writeas get aaaazzzzzzzza -Hello world! -``` - -#### Authenticate - -This will authenticate with write.as and store the user access token locally, until you explicitly logout. -```bash -$ writeas auth username -Password: ************ -``` - -#### List all blogs - -This will output a list of the authenticated user's blogs. -```bash -$ writeas blogs -Alias Title -user An Example Blog -dev My Dev Log -``` - -#### List posts - -This lists all anonymous posts you've published. If authenticated, it will include posts on your account as well as any local / unclaimed posts. - -Pass the `--url` flag to show the list with full post URLs, and the `--md` flag to return URLs with Markdown enabled. - -To see post IDs with their Edit Tokens pass the `--v` flag. - -```bash -$ writeas posts -aaaazzzzzzzza - -$ writeas posts -url -https://write.as/aaaazzzzzzzza - -$ writeas posts -v -ID Token -aaaazzzzzzzza dhuieoj23894jhf984hdfs9834hdf84j -``` - -#### Delete a post - -This permanently deletes a post you own. - -```bash -$ writeas delete aaaazzzzzzzza -``` - -#### Update a post - -This completely overwrites an existing post you own. - -```bash -$ echo "See you later!" | writeas update aaaazzzzzzzza -``` - -#### Claim a post - -This moves an unsynced local post to a draft on your account. You will need to authenticate first. -```bash -$ writeas claim aaaazzzzzzzza -``` - -### Composing posts - -If you simply have a penchant for never leaving your keyboard, `writeas` is great for composing new posts from the command-line. Just use the `new` subcommand. - -`writeas new` will open your favorite command-line editor, as specified by your `WRITEAS_EDITOR` or `EDITOR` environment variables (in that order), falling back to `vim` on OS X / *nix. - -Customize your post's appearance with the `--font` flag: - -| Argument | Appearance (Typeface) | Word Wrap? | -| -------- | --------------------- | ---------- | -| `sans` | Sans-serif (Open Sans) | Yes | -| `serif` | Serif (Lora) | Yes | -| `wrap` | Monospace | Yes | -| `mono` | Monospace | No | -| `code` | Syntax-highlighted monospace | No | - -Put it all together, e.g. publish with a sans-serif font: `writeas new --font sans` - -If you're publishing Markdown, supply the `--md` flag to get a URL back that will render Markdown, e.g.: `writeas new --font sans --md` +## WriteFreely CLI +See full usage documentation on our [wf-cli User Guide](https://github.com/writeas/writeas-cli/blob/master/cmd/wf/GUIDE.md). diff --git a/README.md b/README.md index a39a162..97a4a34 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ -writeas-cli -=========== +writeas-cli / wf-cli +==================== ![GPL](https://img.shields.io/github/license/writeas/writeas-cli.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/writeas/writeas-cli)](https://goreportcard.com/report/github.com/writeas/writeas-cli) [![#writeas on freenode](https://img.shields.io/badge/freenode-%23writeas-blue.svg)](http://webchat.freenode.net/?channels=writeas) [![Discuss on our forum](https://img.shields.io/discourse/https/discuss.write.as/users.svg?label=forum)](https://discuss.write.as/c/development) -Command line interface for [Write.as](https://write.as). Works on Windows, macOS, and Linux. +Command line utility for publishing to [Write.as](https://write.as) and any other [WriteFreely](https://writefreely.org) instance. Works on Windows, macOS, and Linux. ## Features -* Publish anonymously to Write.as -* Authenticate with a Write.as account +* Authenticate with a Write.as / WriteFreely account +* Publish anonymous posts or drafts to Write.as or WriteFreely, respectively * A stable, easy back-end for your [GUI app](https://write.as/apps/desktop) or desktop-based workflow -* Compatible with our [Tor hidden service](http://writeas7pm7rcdqg.onion/) -* Locally keeps track of any posts you make -* Update and delete posts, anonymous and authenticated +* Compatible with the [Write.as Tor hidden service](http://writeas7pm7rcdqg.onion/) +* Update and delete posts * Fetch any post by ID -* Add anonymous post credentials (like for one published with the [Android app](https://play.google.com/store/apps/details?id=com.abunchtell.writeas)) for editing +* ...and more, depending on which client you're using (see respective READMEs for more) ## Installing The easiest way to get the CLI is to download a pre-built executable for your OS. @@ -23,78 +22,19 @@ The easiest way to get the CLI is to download a pre-built executable for your OS Get the latest version for your operating system as a standalone executable. -**Windows**
-Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_windows_amd64.zip) or [32-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_windows_386.zip) executable and put it somewhere in your `%PATH%`. +**Write.as CLI**
+See the [writeas-cli README](https://github.com/writeas/writeas-cli/cmd/writeas#readme) -**macOS**
-Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_darwin_amd64.zip) executable and put it somewhere in your `$PATH`, like `/usr/local/bin`. - -**Debian-based Linux**
-```bash -sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DBE07445 -sudo add-apt-repository "deb http://updates.writeas.org xenial main" -sudo apt-get update && sudo apt-get install writeas-cli -``` - -**Linux (other)**
-Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_linux_amd64.tar.gz) or [32-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_linux_386.tar.gz) executable and put it somewhere in your `$PATH`, like `/usr/local/bin`. - -### Go get it -```bash -go get github.com/writeas/writeas-cli/cmd/writeas -``` - -Once this finishes, you'll see `writeas` or `writeas.exe` inside `$GOPATH/bin/`. - -## Upgrading - -To upgrade the CLI, download and replace the executable you downloaded before. - -If you previously installed with `go get`, run it again with the `-u` option. - -```bash -go get -u github.com/writeas/writeas-cli/cmd/writeas -``` +**WriteFreely CLI**
+See the [wf-cli README](https://github.com/writeas/writeas-cli/cmd/wf#readme) ## Usage -See full usage documentation on our [User Guide](GUIDE.md). - -``` - writeas [global options] command [command options] [arguments...] - -COMMANDS: - post Alias for default action: create post from stdin - new Compose a new post from the command-line and publish - publish Publish a file to Write.as - delete Delete a post - update Update (overwrite) a post - get Read a raw post - add Add an existing post locally - posts List all of your posts - blogs List blogs - claim Claim local unsynced posts - auth Authenticate with Write.as - logout Log out of Write.as - help, h Shows a list of commands or help for one command - -GLOBAL OPTIONS: - -c value, -b value Optional blog to post to - --tor, -t Perform action on Tor hidden service - --tor-port value Use a different port to connect to Tor (default: 9150) - --code Specifies this post is code - --md Returns post URL with Markdown enabled - --verbose, -v Make the operation more talkative - --font value Sets post font to given value (default: "mono") - --lang value Sets post language to given ISO 639-1 language code - --user-agent value Sets the User-Agent for API requests - --host value, -H value Operate against a custom hostname - --user value, -u value Use authenticated user, other than default - --help, -h show help - --version, -V print the version -``` - -> Note: the host and user flags are only available in `wf` the community edition +**Write.as CLI**
+See full usage documentation on our [writeas-cli User Guide](https://github.com/writeas/writeas-cli/blob/master/cmd/writeas/GUIDE.md). + +**WriteFreely CLI**
+See full usage documentation on our [wf-cli User Guide](https://github.com/writeas/writeas-cli/blob/master/cmd/wf/GUIDE.md). ## Contributing to the CLI @@ -108,4 +48,4 @@ We're available on [several channels](https://write.as/contact), and prefer our ### Reporting Issues -If you believe you have found a bug in the CLI or its documentation, file an issue on this repo. If you're not sure if it's a bug or not, [reach out to us](https://write.as/contact) in one way or another. Be sure to provide the version of the CLI (with `writeas --version`) in your report. +If you believe you have found a bug in the CLI or its documentation, file an issue on this repo. If you're not sure if it's a bug or not, [reach out to us](https://write.as/contact) in one way or another. Be sure to provide the version of the CLI (with `writeas --version` or `wf --version`) in your report. diff --git a/cmd/wf/GUIDE.md b/cmd/wf/GUIDE.md new file mode 100644 index 0000000..48e4615 --- /dev/null +++ b/cmd/wf/GUIDE.md @@ -0,0 +1,164 @@ +# WriteFreely CLI User Guide + +The WriteFreely Command-Line Interface (CLI) is a cross-platform tool for publishing text to any [WriteFreely](https://writefreely.org) instance. It is designed to be simple, scriptable, do one job (publishing) well, and work as you'd expect with other command-line tools. + +WriteFreely is the software behind [Write.as](https://write.as). While the WriteFreely CLI supports publishing to Write.as, we recommend using the dedicated [Write.as CLI](https://github.com/writeas/writeas-cli/tree/master/cmd/writeas#readme) to get the full features of the platform, including anonymous publishing. + +**The WriteFreely CLI is compatible with WriteFreely v0.11 or later.** + +## Uses + +These are a few common uses for `wf`. If you get stuck or want to know more, run `wf [command] --help`. If you still have questions, [ask us](https://write.as/contact). + +### Overview + +``` + wf [global options] command [command options] [arguments...] + +COMMANDS: + post Alias for default action: create post from stdin + new Compose a new post from the command-line and publish + publish Publish a file + delete Delete a post + update Update (overwrite) a post + get Read a raw post + posts List all of your posts + blogs List blogs + auth Authenticate with a WriteFreely instance + logout Log out of a WriteFreely instance + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + -c value, -b value Optional blog to post to + --insecure Send request insecurely. + --tor, -t Perform action on Tor hidden service + --tor-port value Use a different port to connect to Tor (default: 9150) + --code Specifies this post is code + --verbose, -v Make the operation more talkative + --font value Sets post font to given value (default: "mono") + --lang value Sets post language to given ISO 639-1 language code + --user-agent value Sets the User-Agent for API requests + --host value, -H value Use the given WriteFreely instance hostname + --user value, -u value Use the given account username + --help, -h show help + --version, -V print the version +``` + +#### Authenticate + +To use the WriteFreely CLI, you'll first need to authenticate with the WriteFreely instance you want to interact with. + +You may authenticate with as many WriteFreely instances and accounts as you want. But the first account you authenticate with will automatically be set as the default instance to operate on, so you don't have to supply `--host` and `--user` with every command. + +```bash +$ wf --host pencil.writefree.ly auth username +Password: ************ +``` + +In this example, you'll be authenticated as the user **username** on the WriteFreely instance **https://pencil.writefree.ly**. + +#### Choosing an account + +To select the WriteFreely instance and account you want to interact with, supply the `--host` and `--user` flags at the beginning of your `wf` command, e.g.: + +``` +$ wf --host pencil.writefree.ly --user username +``` + +If you're authenticated with only one account on any given WriteFreely instance, you only need to supply the `--host`, and `wf` will automatically use the correct account. E.g.: + +``` +$ wf --host pencil.writefree.ly +``` + +If a default account is set in `~/.writefreely/config.ini` and you want to use it, you don't need to supply any additional arguments. E.g.: + +``` +$ wf +``` + +#### Share something + +By default, `wf` creates a post with a `monospace` typeface that doesn't word wrap (scrolls horizontally). It will return a single line with a URL, and automatically copy that URL to the clipboard. + +```bash +$ echo "Hello world!" | wf +https://pencil.writefree.ly/aaaaazzzzz +``` + +This is generally more useful for posting terminal output or code, like so (the `--code` flag turns on syntax highlighting): + +macOS / Linux: `cat cmd/wf/cli.go | wf --code` + +Windows: `type cmd/wf/cli.go | wf.exe --code` + +#### Output a post + +This outputs any WriteFreely post with the given ID. + +```bash +$ wf get aaaaazzzzz +Hello world! +``` + +#### List all blogs + +This will output a list of the authenticated user's blogs. +```bash +$ wf blogs +Alias Title +user An Example Blog +dev My Dev Log +``` + +#### List posts + +This lists all draft posts you've published. + +Pass the `--url` flag to show the list with full post URLs. + +```bash +$ wf posts +aaaaazzzzz + +$ wf posts -url +https://pencil.writefree.ly/aaaaazzzzz + +$ wf posts +ID +aaaaazzzzz +``` + +#### Delete a post + +This permanently deletes a post with the given ID. + +```bash +$ wf delete aaaaazzzzz +``` + +#### Update a post + +This completely overwrites an existing post with the given ID. + +```bash +$ echo "See you later!" | wf update aaaaazzzzz +``` + +### Composing posts + +If you simply have a penchant for never leaving your keyboard, `wf` is great for composing new posts from the command-line. Just use the `new` subcommand. + +`wf new` will open your favorite command-line editor, as specified by your `WRITEAS_EDITOR` or `EDITOR` environment variables (in that order), falling back to `vim` on OS X / *nix. + +Customize your post's appearance with the `--font` flag: + +| Argument | Appearance (Typeface) | Word Wrap? | +| -------- | --------------------- | ---------- | +| `sans` | Sans-serif (Open Sans) | Yes | +| `serif` | Serif (Lora) | Yes | +| `wrap` | Monospace | Yes | +| `mono` | Monospace | No | +| `code` | Syntax-highlighted monospace | No | + +Put it all together, e.g. publish with a sans-serif font: `wf new --font sans` diff --git a/cmd/wf/README.md b/cmd/wf/README.md new file mode 100644 index 0000000..a725adc --- /dev/null +++ b/cmd/wf/README.md @@ -0,0 +1,109 @@ +wf-cli +====== +![GPL](https://img.shields.io/github/license/writeas/writeas-cli.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/writeas/writeas-cli)](https://goreportcard.com/report/github.com/writeas/writeas-cli) [![#writeas on freenode](https://img.shields.io/badge/freenode-%23writeas-blue.svg)](http://webchat.freenode.net/?channels=writeas) [![Discuss on our forum](https://img.shields.io/discourse/https/discuss.write.as/users.svg?label=forum)](https://discuss.write.as/c/development) + +Command line utility for publishing to any [WriteFreely](https://writefreely.org) instance. Works on Windows, macOS, and Linux. + +**The WriteFreely CLI is compatible with WriteFreely v0.11 or later.** + +## Features + +* Authenticate with any WriteFreely instance +* Publish drafts +* Manage multiple WriteFreely accounts on multiple instances +* A stable, easy back-end for your GUI app or desktop-based workflow +* Locally keeps track of any posts you make +* Update and delete posts +* Fetch any post by ID + +## Installing +The easiest way to get the CLI is to download a pre-built executable for your OS. + +### Download +[![Latest release](https://img.shields.io/github/release/writeas/writeas-cli.svg)](https://github.com/writeas/writeas-cli/releases/latest) ![Total downloads](https://img.shields.io/github/downloads/writeas/writeas-cli/total.svg) + +Get the latest version for your operating system as a standalone executable. + +**Windows**
+Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/wf_2.0.0_windows_amd64.zip) or [32-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/wf_2.0.0_windows_386.zip) executable and put it somewhere in your `%PATH%`. + +**macOS**
+Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/wf_2.0.0_darwin_amd64.zip) executable and put it somewhere in your `$PATH`, like `/usr/local/bin`. + +**Debian-based Linux**
+```bash +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DBE07445 +sudo add-apt-repository "deb http://updates.writeas.org xenial main" +sudo apt-get update && sudo apt-get install wf-cli +``` + +**Linux (other)**
+Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/wf_2.0.0_linux_amd64.tar.gz) or [32-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/wf_2.0.0_linux_386.tar.gz) executable and put it somewhere in your `$PATH`, like `/usr/local/bin`. + +### Go get it +```bash +go get github.com/writeas/writeas-cli/cmd/wf +``` + +Once this finishes, you'll see `wf` or `wf.exe` inside `$GOPATH/bin/`. + +## Upgrading + +To upgrade the CLI, download and replace the executable you downloaded before. + +If you previously installed with `go get`, run it again with the `-u` option. + +```bash +go get -u github.com/writeas/writeas-cli/cmd/wf +``` + +## Usage + +See full usage documentation on our [User Guide](https://github.com/writeas/writeas-cli/blob/master/cmd/wf/GUIDE.md). + +``` + wf [global options] command [command options] [arguments...] + +COMMANDS: + post Alias for default action: create post from stdin + new Compose a new post from the command-line and publish + publish Publish a file + delete Delete a post + update Update (overwrite) a post + get Read a raw post + posts List draft posts + blogs List blogs + accounts List all currently logged in accounts + auth Authenticate with a WriteFreely instance + logout Log out of a WriteFreely instance + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + -c value, -b value Optional blog to post to + --tor, -t Perform action on Tor hidden service + --tor-port value Use a different port to connect to Tor (default: 9150) + --code Specifies this post is code + --md Returns post URL with Markdown enabled + --verbose, -v Make the operation more talkative + --font value Sets post font to given value (default: "mono") + --lang value Sets post language to given ISO 639-1 language code + --user-agent value Sets the User-Agent for API requests + --host value, -H value Operate against a custom hostname + --user value, -u value Use authenticated user, other than default + --help, -h show help + --version, -V print the version +``` + +## Contributing to the CLI + +For a complete guide to contributing, see the [Contribution Guide](.github/CONTRIBUTING.md). + +We welcome any kind of contributions including documentation, organizational improvements, tutorials, bug reports, feature requests, new features, answering questions, etc. + +### Getting Support + +We're available on [several channels](https://write.as/contact), and prefer our [forum](https://discuss.write.as) for project discussion. Please don't use the GitHub issue tracker to ask questions. + +### Reporting Issues + +If you believe you have found a bug in the CLI or its documentation, file an issue on this repo. If you're not sure if it's a bug or not, [reach out to us](https://write.as/contact) in one way or another. Be sure to provide the version of the CLI (with `wf --version`) in your report. diff --git a/cmd/writeas/GUIDE.md b/cmd/writeas/GUIDE.md new file mode 100644 index 0000000..fae366e --- /dev/null +++ b/cmd/writeas/GUIDE.md @@ -0,0 +1,149 @@ +# Write.as CLI User Guide + +The Write.as Command-Line Interface (CLI) is a cross-platform tool for publishing text to [Write.as](https://write.as) and its other sites, like [Paste.as](https://paste.as). It is designed to be simple, scriptable, do one job (publishing) well, and work as you'd expect with other command-line tools. + +Write.as is a text-publishing service that protects your privacy. There's no sign up required to publish, but if you do sign up, you can access posts across devices and compile collections of them in what most people would call a "blog". + +## Uses + +These are a few common uses for `writeas`. If you get stuck or want to know more, run `writeas [command] --help`. If you still have questions, [ask us](https://write.as/contact). + +### Overview + +``` + writeas [global options] command [command options] [arguments...] + +COMMANDS: + post Alias for default action: create post from stdin + new Compose a new post from the command-line and publish + publish Publish a file to Write.as + delete Delete a post + update Update (overwrite) a post + get Read a raw post + add Add an existing post locally + posts List all of your posts + claim Claim local unsynced posts + blogs List blogs + claim Claim local unsynced posts + auth Authenticate with Write.as + logout Log out of Write.as + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + -c value, -b value Optional blog to post to + --tor, -t Perform action on Tor hidden service + --tor-port value Use a different port to connect to Tor (default: 9150) + --code Specifies this post is code + --md Returns post URL with Markdown enabled + --verbose, -v Make the operation more talkative + --font value Sets post font to given value (default: "mono") + --lang value Sets post language to given ISO 639-1 language code + --user-agent value Sets the User-Agent for API requests + --help, -h show help + --version, -V print the version +``` + +#### Share something + +By default, `writeas` creates a post with a `monospace` typeface that doesn't word wrap (scrolls horizontally). It will return a single line with a URL, and automatically copy that URL to the clipboard: + +```bash +$ echo "Hello world!" | writeas +https://write.as/aaaazzzzzzzza +``` + +This is generally more useful for posting terminal output or code, like so (the `--code` flag turns on syntax highlighting): + +macOS / Linux: `cat writeas/cli.go | writeas --code` + +Windows: `type writeas/cli.go | writeas.exe --code` + +#### Output a post + +This outputs any Write.as post with the given ID. + +```bash +$ writeas get aaaazzzzzzzza +Hello world! +``` + +#### Authenticate + +This will authenticate with write.as and store the user access token locally, until you explicitly logout. +```bash +$ writeas auth username +Password: ************ +``` + +#### List all blogs + +This will output a list of the authenticated user's blogs. +```bash +$ writeas blogs +Alias Title +user An Example Blog +dev My Dev Log +``` + +#### List posts + +This lists all anonymous posts you've published. If authenticated, it will include posts on your account as well as any local / unclaimed posts. + +Pass the `--url` flag to show the list with full post URLs, and the `--md` flag to return URLs with Markdown enabled. + +To see post IDs with their Edit Tokens pass the `--v` flag. + +```bash +$ writeas posts +aaaazzzzzzzza + +$ writeas posts -url +https://write.as/aaaazzzzzzzza + +$ writeas posts -v +ID Token +aaaazzzzzzzza dhuieoj23894jhf984hdfs9834hdf84j +``` + +#### Delete a post + +This permanently deletes a post you own. + +```bash +$ writeas delete aaaazzzzzzzza +``` + +#### Update a post + +This completely overwrites an existing post you own. + +```bash +$ echo "See you later!" | writeas update aaaazzzzzzzza +``` + +#### Claim a post + +This moves an unsynced local post to a draft on your account. You will need to authenticate first. +```bash +$ writeas claim aaaazzzzzzzza +``` + +### Composing posts + +If you simply have a penchant for never leaving your keyboard, `writeas` is great for composing new posts from the command-line. Just use the `new` subcommand. + +`writeas new` will open your favorite command-line editor, as specified by your `WRITEAS_EDITOR` or `EDITOR` environment variables (in that order), falling back to `vim` on OS X / *nix. + +Customize your post's appearance with the `--font` flag: + +| Argument | Appearance (Typeface) | Word Wrap? | +| -------- | --------------------- | ---------- | +| `sans` | Sans-serif (Open Sans) | Yes | +| `serif` | Serif (Lora) | Yes | +| `wrap` | Monospace | Yes | +| `mono` | Monospace | No | +| `code` | Syntax-highlighted monospace | No | + +Put it all together, e.g. publish with a sans-serif font: `writeas new --font sans` + +If you're publishing Markdown, supply the `--md` flag to get a URL back that will render Markdown, e.g.: `writeas new --font sans --md` diff --git a/cmd/writeas/README.md b/cmd/writeas/README.md new file mode 100644 index 0000000..8ec40e8 --- /dev/null +++ b/cmd/writeas/README.md @@ -0,0 +1,109 @@ +writeas-cli +=========== +![GPL](https://img.shields.io/github/license/writeas/writeas-cli.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/writeas/writeas-cli)](https://goreportcard.com/report/github.com/writeas/writeas-cli) [![#writeas on freenode](https://img.shields.io/badge/freenode-%23writeas-blue.svg)](http://webchat.freenode.net/?channels=writeas) [![Discuss on our forum](https://img.shields.io/discourse/https/discuss.write.as/users.svg?label=forum)](https://discuss.write.as/c/development) + +Command line utility for publishing to [Write.as](https://write.as). Works on Windows, macOS, and Linux. + +## Features + +* Publish anonymously to Write.as +* Authenticate with a Write.as account +* A stable, easy back-end for your [GUI app](https://write.as/apps/desktop) or desktop-based workflow +* Compatible with our [Tor hidden service](http://writeas7pm7rcdqg.onion/) +* Locally keeps track of any posts you make +* Update and delete posts, anonymous and authenticated +* Fetch any post by ID +* Add anonymous post credentials (like for one published with the [Android app](https://play.google.com/store/apps/details?id=com.abunchtell.writeas)) for editing + +## Installing +The easiest way to get the CLI is to download a pre-built executable for your OS. + +### Download +[![Latest release](https://img.shields.io/github/release/writeas/writeas-cli.svg)](https://github.com/writeas/writeas-cli/releases/latest) ![Total downloads](https://img.shields.io/github/downloads/writeas/writeas-cli/total.svg) + +Get the latest version for your operating system as a standalone executable. + +**Windows**
+Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_windows_amd64.zip) or [32-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_windows_386.zip) executable and put it somewhere in your `%PATH%`. + +**macOS**
+Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_darwin_amd64.zip) executable and put it somewhere in your `$PATH`, like `/usr/local/bin`. + +**Debian-based Linux**
+```bash +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DBE07445 +sudo add-apt-repository "deb http://updates.writeas.org xenial main" +sudo apt-get update && sudo apt-get install writeas-cli +``` + +**Linux (other)**
+Download the [64-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_linux_amd64.tar.gz) or [32-bit](https://github.com/writeas/writeas-cli/releases/download/v2.0.0/writeas_2.0.0_linux_386.tar.gz) executable and put it somewhere in your `$PATH`, like `/usr/local/bin`. + +### Go get it +```bash +go get github.com/writeas/writeas-cli/cmd/writeas +``` + +Once this finishes, you'll see `writeas` or `writeas.exe` inside `$GOPATH/bin/`. + +## Upgrading + +To upgrade the CLI, download and replace the executable you downloaded before. + +If you previously installed with `go get`, run it again with the `-u` option. + +```bash +go get -u github.com/writeas/writeas-cli/cmd/writeas +``` + +## Usage + +See full usage documentation on our [User Guide](https://github.com/writeas/writeas-cli/blob/master/cmd/writeas/GUIDE.md). + +``` + writeas [global options] command [command options] [arguments...] + +COMMANDS: + post Alias for default action: create post from stdin + new Compose a new post from the command-line and publish + publish Publish a file to Write.as + delete Delete a post + update Update (overwrite) a post + get Read a raw post + add Add an existing post locally + posts List all of your posts + blogs List blogs + claim Claim local unsynced posts + auth Authenticate with Write.as + logout Log out of Write.as + help, h Shows a list of commands or help for one command + +GLOBAL OPTIONS: + -c value, -b value Optional blog to post to + --tor, -t Perform action on Tor hidden service + --tor-port value Use a different port to connect to Tor (default: 9150) + --code Specifies this post is code + --md Returns post URL with Markdown enabled + --verbose, -v Make the operation more talkative + --font value Sets post font to given value (default: "mono") + --lang value Sets post language to given ISO 639-1 language code + --user-agent value Sets the User-Agent for API requests + --host value, -H value Operate against a custom hostname + --user value, -u value Use authenticated user, other than default + --help, -h show help + --version, -V print the version +``` + +## Contributing to the CLI + +For a complete guide to contributing, see the [Contribution Guide](.github/CONTRIBUTING.md). + +We welcome any kind of contributions including documentation, organizational improvements, tutorials, bug reports, feature requests, new features, answering questions, etc. + +### Getting Support + +We're available on [several channels](https://write.as/contact), and prefer our [forum](https://discuss.write.as) for project discussion. Please don't use the GitHub issue tracker to ask questions. + +### Reporting Issues + +If you believe you have found a bug in the CLI or its documentation, file an issue on this repo. If you're not sure if it's a bug or not, [reach out to us](https://write.as/contact) in one way or another. Be sure to provide the version of the CLI (with `writeas --version`) in your report.