Skip to content

Commit 880daa3

Browse files
committed
docs(help): add example
1 parent 056c9c3 commit 880daa3

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/args/cmd/ing.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ use clap::Parser;
44
pub struct Opt {
55
#[arg(verbatim_doc_comment)]
66
/// Show ing list, order by time in DESC
7+
/// Example: cnb ing --list
78
#[arg(long)]
89
#[arg(short = 'l')]
910
pub list: bool,
1011

1112
#[arg(verbatim_doc_comment)]
1213
/// Publish ing with specific content
14+
/// Example: cnb ing --publish 'Hello world'
1315
/// The visibility of ing is public
1416
#[arg(long)]
1517
#[arg(short = 'p')]
@@ -19,6 +21,7 @@ pub struct Opt {
1921

2022
#[arg(verbatim_doc_comment)]
2123
/// Comment ing with specific content
24+
/// Example: cnb --id 114514 ing --comment 'Hello world'
2225
/// You should also specify the id of ing via option --id
2326
#[arg(long)]
2427
#[arg(short = 'c')]

src/args/cmd/post.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,40 @@ use clap::Parser;
44
pub struct Opt {
55
#[arg(verbatim_doc_comment)]
66
/// Show title and content of a specific post
7+
/// Example: cnb --id 114514 post --show
78
/// You should also specify the id of post via option --id
89
#[arg(long)]
910
#[arg(short = 's')]
1011
pub show: bool,
1112

1213
#[arg(verbatim_doc_comment)]
1314
/// Show metadata of a specific post
15+
/// Example: cnb --id 114514 post --show-meta
1416
/// You should also specify the id of post via option --id
1517
#[arg(long)]
1618
#[arg(short = 'm')]
1719
pub show_meta: bool,
1820

1921
#[arg(verbatim_doc_comment)]
2022
/// Show post list, order by time in DESC
23+
/// Example: cnb post --list
2124
/// <LENGTH> should in range [0,100]
2225
/// If <LENGTH> greater than 100, it will be set to 100
2326
#[arg(long)]
2427
#[arg(short = 'l')]
25-
#[arg(default_missing_value = "8")]
26-
#[arg(value_name = "LENGTH")]
2728
pub list: bool,
2829

2930
#[arg(verbatim_doc_comment)]
3031
/// Delete post
32+
/// Example: cnb --id 114514 post --delete
3133
/// You should also specify the id of post via option --id
3234
#[arg(long)]
3335
#[arg(visible_alias = "del")]
3436
pub delete: bool,
3537

3638
#[arg(verbatim_doc_comment)]
3739
/// Search post by keyword and output the post id list that matches
38-
/// Example: cnb post --search FOO
40+
/// Example: cnb post --search 'Hello world'
3941
#[arg(long)]
4042
#[arg(value_name = "KEYWORD")]
4143
pub search: Option<String>,

src/args/cmd/user.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use clap::Parser;
44
pub struct Opt {
55
#[arg(verbatim_doc_comment)]
66
/// Login with your personal access token (PAT)
7+
/// Example: cnb user --login FOOBARBAZ
78
/// PAT will be saved in ~/.cnbrc
89
/// You can create PAT in https://account.cnblogs.com/tokens
910
#[arg(long)]
@@ -12,11 +13,13 @@ pub struct Opt {
1213

1314
#[arg(verbatim_doc_comment)]
1415
/// Logout and remove ~/.cnbrc
16+
/// Example: cnb user --logout
1517
#[arg(long)]
1618
pub logout: bool,
1719

1820
#[arg(verbatim_doc_comment)]
1921
/// Show user info
22+
/// Example: cnb user --info
2023
#[arg(long)]
2124
#[arg(short = 'i')]
2225
pub info: bool,

0 commit comments

Comments
 (0)