telegra.ph from your friendly terminal.
telegra.ph is a minimalist content publishing platform for users to quickly share richly formatted post. telegraphcl
lets you use
telegra.ph from command-line, using Markdown file to draft your posts.
Here's what you can do with telegraphcl
Please make sure go binaries are accessible. i.e for UNIX,
$ export PATH=$PATH:~/go/bin/
$ go get github.com/plant99/telegraphcl/cmd/telegraphcl
Let's say examples
directory has the markdown files to be used to create/edit pages.
$ docker run -v ~/.telegraphcl:/root/.telegraphcl -v "$PWD"/examples:/root/telegraph-blogs/ -it plant99/telegraphcl --help
$ telegraphcl --help
Usage:
telegraphcl [command]
Available Commands:
help Help about any command
page Manage your Telegra.ph pages
user Operations related to Telegraph account management
version Print the version number of telegraphcl
Flags:
-h, --help help for telegraphcl
Use "telegraphcl [command] --help" for more information about a command.
With this command, one can handle an user account to manage your pages. A token is generated and stored at ~/.telegraphcl/telegraph.token
Operations related to Telegraph account management
Usage:
telegraphcl user [command]
Available Commands:
create Create an user
edit Edit current user information
revoke Revoke current access token, and regenerate access token.
view View current user information
Flags:
-h, --help help for user
Use "telegraphcl user [command] --help" for more information about a command.
Some things to note on user management.
-
If you run the following command after creating an user
$ telegraphcl user view
The
AuthURL
can be used in web-browsers to authenticate this user to perform create/edit operations from the user account referred to by thetelegraph.token
. -
revoke
option revokes the current access token, and creates a new one for thesame
user account.
With this option, one can manage pages. Some things to note
- Markdown files are used to
create
, andedit
a page. If one changes the pages on a browser these changes don't currently sync with the markdown files one used to create a page. - means the identity of the 'page' with telegraph. For example,
https://telegra.ph/some-title-11-07
. The<path>
for this URL issome-title-11-07
. <markdown-path>
means path to the Markdown file used to create/edit a telegra.ph page.- Create a directory to keep all the Markdown files for telegra.ph pages. This would here on be referenced as
<markdown-dir>
Manage your Telegra.ph pages
Usage:
telegraphcl page [command]
Available Commands:
create Create Page from a Markdown file. Arguments: <markdown-path> <title>
edit Edit page with Telegra.ph path. Arguments: <path> <markdown-path>
get Get page with Telegra.ph path. Arguments: <path>
list List your Telegra.ph pages
views Count views on your Telegra.ph page. Arguments: <path>
Flags:
-h, --help help for page
Use "telegraphcl page [command] --help" for more information about a command.
Create a markdown file in <markdown-dir>
, say first_page.md
. Then run the following command
$ telegraphcl page create <markdown-dir>/first_page.md "My first blog"
Note for docker image users: The WORKDIR
is /root/telegraph-blogs
so to reference files, you can assume you're running telegraph
from <markdown-dir>
.
So assuming examples
is my <markdown-dir>
, the following would create a page.
$ docker run -v ~/.telegraphcl:/root/.telegraphcl -v "$PWD"/examples:/root/telegraph-blogs/ -it plant99/telegraphcl page create tiny_blogpost.md some-title
List the pages you created by running the following command
$ telegraphcl page list
To get details of a page, record the <path>
of the page. Then run
$ telegraphcl page get <path>
To edit a page, record the <path>
of the page. Make modifications to first_page.md
, then run
$ telegraphcl page edit <path> <markdown-dir>/first_page.md
To get the count of views on a particular page, run the following command.
$ telegraphcl page views <path>
Prints the version of telegraphcl
.
telegra.ph doesn't support all Markdown formatting
- h1 elements,
#
in Markdown format. - h2 elements,
##
in Markdown format.
There could be others, please raise an issue in that case, the documentation would be updated.
Please file an issue, or make a patch via GitHub PRs if you have time.
This is an educational project to practice some Golang, some code has been used unabridged from https://github.com/toby3d/telegraph and
https://github.com/meinside/telegraph-go
Thank you, for checking out telegraphcl
.