Access cnblogs form CLI.
To use cnb
directly, add it to your environment variables is required.
You need to get your PAT from https://account.cnblogs.com/settings/tokens to use this tool.
Then run cnb user --login 'YOUR_PAT_HERE'
. This will save your PAT to ~/.cnbrc
.
If you want to logout, run cnb user --logout
or just remove ~/.cnbrc
.
It's time to enjoy cnblogs.
Here are some simple examples:
# Check your post list
cnb post --list
# Check your post
cnb --id 114514 post --show
# Create and publish post
cnb post create --title 'Hello' --body 'world!' --publish
# Change your post body
cnb --id 114514 post update --body 'niconiconiconi'
# Show ing list
cnb ing list
# Publish ing
cnb ing --publish 'Hello world!'
# Comment to ing
cnb --id 114514 ing --comment 'Awesome!'
# Check your user infomation
cnb user --info
For more information, try cnb --help
.
This tool requires nightly toolchains(1.74.0+) to build.
git clone --depth 1 https://github.com/cnblogs/cli.git
cd cli
cargo build -r
Or get binaries from CI artifacts.
We’d love to hear your thoughts on this project. Feel free to drop us a note!