|
2 | 2 |
|
3 | 3 | [](https://github.com/cnblogs/cli/actions/workflows/build-release.yml)
|
4 | 4 | [](https://github.com/cnblogs/cli/actions/workflows/build-dev.yml)
|
| 5 | + |
| 6 | +Access cnblogs form CLI. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +To use `cnb` directly, register it to your environment variables is required. |
| 11 | + |
| 12 | +### Login |
| 13 | + |
| 14 | +You need to get your PAT from [https://account.cnblogs.com/settings/tokens](https://account.cnblogs.com/settings/tokens) to use this tool. |
| 15 | + |
| 16 | +Then run `cnb user --login 'YOUR_PAT_HERE'`. This will save your PAT to `~/.cnbrc`. |
| 17 | + |
| 18 | +If you want to logout, run `cnb user --logout` or just remove `~/.cnbrc`. |
| 19 | + |
| 20 | +### Examples |
| 21 | + |
| 22 | +After login, it's time to enjoy cnblogs. |
| 23 | + |
| 24 | +Here are some simple examples: |
| 25 | + |
| 26 | +```shell |
| 27 | +# Check your post list |
| 28 | +cnb post --list |
| 29 | +# Check your post |
| 30 | +cnb --id 114514 post --show |
| 31 | +# Create and publish post |
| 32 | +cnb post create --title 'Hello' --body 'world!' --publish |
| 33 | +# Change your post body |
| 34 | +cnb --id 114514 post update --body 'niconiconiconi' |
| 35 | + |
| 36 | +# Show ing list |
| 37 | +cnb ing --list |
| 38 | +# Publish ing |
| 39 | +cnb ing --pub 'Hello world!' |
| 40 | +# Comment to ing |
| 41 | +cnb --id 114514 ing --comment 'Awesome!' |
| 42 | + |
| 43 | +# Check your user infomation |
| 44 | +cnb user --info |
| 45 | +``` |
| 46 | + |
| 47 | +For more information, try `cnb --help`. |
| 48 | + |
| 49 | +## Installation |
| 50 | + |
| 51 | +### Build |
| 52 | + |
| 53 | +This tool needs nightly toolchains(1.74.0+) to build. |
| 54 | + |
| 55 | +```shell |
| 56 | +git clone --depth 1 https://github.com/cnblogs/cli.git |
| 57 | +cd cli |
| 58 | +cargo build -r |
| 59 | +``` |
| 60 | + |
| 61 | +Or get binaries from [CI](https://github.com/cnblogs/cli/actions) artifacts. |
| 62 | + |
| 63 | +### License |
| 64 | + |
| 65 | +[MIT](https://raw.githubusercontent.com/cnblogs/cli/main/LICENSE) |
| 66 | + |
| 67 | +### Feedback |
| 68 | + |
| 69 | +We’d love to hear your thoughts on this project. Feel free to drop us a note! |
| 70 | + |
| 71 | +[Issues](https://github.com/cnblogs/cli/issues) |
0 commit comments