Command line client for Write.as https://write.as/apps/cli
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

GUIDE.md 4.8 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. # Write.as CLI User Guide
  2. 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.
  3. 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".
  4. ## Uses
  5. 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).
  6. ### Overview
  7. ```
  8. writeas [global options] command [command options] [arguments...]
  9. COMMANDS:
  10. post Alias for default action: create post from stdin
  11. new Compose a new post from the command-line and publish
  12. publish Publish a file to Write.as
  13. delete Delete a post
  14. update Update (overwrite) a post
  15. get Read a raw post
  16. add Add an existing post locally
  17. posts List all of your posts
  18. claim Claim local unsynced posts
  19. blogs List blogs
  20. auth Authenticate with Write.as
  21. logout Log out of Write.as
  22. help, h Shows a list of commands or help for one command
  23. GLOBAL OPTIONS:
  24. -c value, -b value Optional blog to post to
  25. --tor, -t Perform action on Tor hidden service
  26. --tor-port value Use a different port to connect to Tor (default: 9150)
  27. --code Specifies this post is code
  28. --md Returns post URL with Markdown enabled
  29. --verbose, -v Make the operation more talkative
  30. --font value Sets post font to given value (default: "mono")
  31. --lang value Sets post language to given ISO 639-1 language code
  32. --user-agent value Sets the User-Agent for API requests
  33. --help, -h show help
  34. --version, -V print the version
  35. ```
  36. #### Share something
  37. 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:
  38. ```bash
  39. $ echo "Hello world!" | writeas
  40. https://write.as/aaaazzzzzzzza
  41. ```
  42. This is generally more useful for posting terminal output or code, like so (the `--code` flag turns on syntax highlighting):
  43. macOS / Linux: `cat writeas/cli.go | writeas --code`
  44. Windows: `type writeas/cli.go | writeas.exe --code`
  45. #### Output a post
  46. This outputs any Write.as post with the given ID.
  47. ```bash
  48. $ writeas get aaaazzzzzzzza
  49. Hello world!
  50. ```
  51. #### Authenticate
  52. This will authenticate with write.as and store the user access token locally, until you explicitly logout.
  53. ```bash
  54. $ writeas auth username
  55. Password: ************
  56. ```
  57. #### List all blogs
  58. This will output a list of the authenticated user's blogs.
  59. ```bash
  60. $ writeas blogs
  61. Alias Title
  62. user An Example Blog
  63. dev My Dev Log
  64. ```
  65. #### List posts
  66. This lists all anonymous posts you've published. If authenticated, it will include posts on your account as well as any local / unclaimed posts.
  67. Pass the `--url` flag to show the list with full post URLs, and the `--md` flag to return URLs with Markdown enabled.
  68. To see post IDs with their Edit Tokens pass the `--v` flag.
  69. ```bash
  70. $ writeas posts
  71. aaaazzzzzzzza
  72. $ writeas posts -url
  73. https://write.as/aaaazzzzzzzza
  74. $ writeas posts -v
  75. ID Token
  76. aaaazzzzzzzza dhuieoj23894jhf984hdfs9834hdf84j
  77. ```
  78. #### Delete a post
  79. This permanently deletes a post you own.
  80. ```bash
  81. $ writeas delete aaaazzzzzzzza
  82. ```
  83. #### Update a post
  84. This completely overwrites an existing post you own.
  85. ```bash
  86. $ echo "See you later!" | writeas update aaaazzzzzzzza
  87. ```
  88. #### Claim a post
  89. This moves an unsynced local post to a draft on your account. You will need to authenticate first.
  90. ```bash
  91. $ writeas claim aaaazzzzzzzza
  92. ```
  93. ### Composing posts
  94. 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.
  95. `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.
  96. Customize your post's appearance with the `--font` flag:
  97. | Argument | Appearance (Typeface) | Word Wrap? |
  98. | -------- | --------------------- | ---------- |
  99. | `sans` | Sans-serif (Open Sans) | Yes |
  100. | `serif` | Serif (Lora) | Yes |
  101. | `wrap` | Monospace | Yes |
  102. | `mono` | Monospace | No |
  103. | `code` | Syntax-highlighted monospace | No |
  104. Put it all together, e.g. publish with a sans-serif font: `writeas new --font sans`
  105. 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`