Command line client for Write.as https://write.as/apps/cli
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # WriteFreely CLI User Guide
  2. 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.
  3. 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.
  4. **The WriteFreely CLI is compatible with WriteFreely v0.11 or later.**
  5. ## Uses
  6. 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).
  7. ### Overview
  8. ```
  9. wf [global options] command [command options] [arguments...]
  10. COMMANDS:
  11. post Alias for default action: create post from stdin
  12. new Compose a new post from the command-line and publish
  13. publish Publish a file
  14. delete Delete a post
  15. update Update (overwrite) a post
  16. get Read a raw post
  17. posts List all of your posts
  18. blogs List blogs
  19. auth Authenticate with a WriteFreely instance
  20. logout Log out of a WriteFreely instance
  21. help, h Shows a list of commands or help for one command
  22. GLOBAL OPTIONS:
  23. -c value, -b value Optional blog to post to
  24. --insecure Send request insecurely.
  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. --verbose, -v Make the operation more talkative
  29. --font value Sets post font to given value (default: "mono")
  30. --lang value Sets post language to given ISO 639-1 language code
  31. --user-agent value Sets the User-Agent for API requests
  32. --host value, -H value Use the given WriteFreely instance hostname
  33. --user value, -u value Use the given account username
  34. --help, -h show help
  35. --version, -V print the version
  36. ```
  37. #### Authenticate
  38. To use the WriteFreely CLI, you'll first need to authenticate with the WriteFreely instance you want to interact with.
  39. 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.
  40. ```bash
  41. $ wf --host pencil.writefree.ly auth username
  42. Password: ************
  43. ```
  44. In this example, you'll be authenticated as the user **username** on the WriteFreely instance **https://pencil.writefree.ly**.
  45. #### Choosing an account
  46. 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.:
  47. ```
  48. $ wf --host pencil.writefree.ly --user username <subcommand>
  49. ```
  50. 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.:
  51. ```
  52. $ wf --host pencil.writefree.ly <subcommand>
  53. ```
  54. 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.:
  55. ```
  56. $ wf <subcommand>
  57. ```
  58. #### Share something
  59. 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.
  60. ```bash
  61. $ echo "Hello world!" | wf
  62. https://pencil.writefree.ly/aaaaazzzzz
  63. ```
  64. This is generally more useful for posting terminal output or code, like so (the `--code` flag turns on syntax highlighting):
  65. macOS / Linux: `cat cmd/wf/cli.go | wf --code`
  66. Windows: `type cmd/wf/cli.go | wf.exe --code`
  67. #### Output a post
  68. This outputs any WriteFreely post with the given ID.
  69. ```bash
  70. $ wf get aaaaazzzzz
  71. Hello world!
  72. ```
  73. #### List all blogs
  74. This will output a list of the authenticated user's blogs.
  75. ```bash
  76. $ wf blogs
  77. Alias Title
  78. user An Example Blog
  79. dev My Dev Log
  80. ```
  81. #### List posts
  82. This lists all draft posts you've published.
  83. Pass the `--url` flag to show the list with full post URLs.
  84. ```bash
  85. $ wf posts
  86. aaaaazzzzz
  87. $ wf posts -url
  88. https://pencil.writefree.ly/aaaaazzzzz
  89. $ wf posts
  90. ID
  91. aaaaazzzzz
  92. ```
  93. #### Delete a post
  94. This permanently deletes a post with the given ID.
  95. ```bash
  96. $ wf delete aaaaazzzzz
  97. ```
  98. #### Update a post
  99. This completely overwrites an existing post with the given ID.
  100. ```bash
  101. $ echo "See you later!" | wf update aaaaazzzzz
  102. ```
  103. ### Composing posts
  104. 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.
  105. `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.
  106. Customize your post's appearance with the `--font` flag:
  107. | Argument | Appearance (Typeface) | Word Wrap? |
  108. | -------- | --------------------- | ---------- |
  109. | `sans` | Sans-serif (Open Sans) | Yes |
  110. | `serif` | Serif (Lora) | Yes |
  111. | `wrap` | Monospace | Yes |
  112. | `mono` | Monospace | No |
  113. | `code` | Syntax-highlighted monospace | No |
  114. Put it all together, e.g. publish with a sans-serif font: `wf new --font sans`