@@ -15,32 +15,42 @@ mod private
1515 #[ derive( Debug , Subcommand ) ]
1616 pub enum Commands
1717 {
18+ /// Command to get a value from a sheet's cell
1819 #[ command( name = "get" ) ]
1920 Get
2021 {
21- #[ arg( long ) ]
22+ #[ arg( long, help = "Full URL of Google Sheet.\n \
23+ It has to be inside of '' to avoid parse errors.\n \
24+ Example: 'https://docs.google.com/spreadsheets/d/your_spreadsheet_id/edit?gid=0#gid=0'" ) ]
2225 url : String ,
2326
24- #[ arg( long ) ]
27+ #[ arg( long, help = "Sheet name. \n Example: List1" ) ]
2528 tab : String ,
2629
27- #[ arg( long ) ]
28- cel : String ,
30+ #[ arg( long, help = "Cell id. You can set it in format:\n \
31+ - A1, where A is column name and 1 is row number\n \
32+ Example: --cell A4" ) ]
33+ cell : String ,
2934 } ,
3035
36+ /// Command to set a new value to a sheet's cell.
3137 #[ command( name = "set" ) ]
3238 Set
3339 {
34- #[ arg( long ) ]
40+ #[ arg( long, help = "Full URL of Google Sheet.\n \
41+ It has to be inside of '' to avoid parse errors.\n \
42+ Example: 'https://docs.google.com/spreadsheets/d/your_spreadsheet_id/edit?gid=0#gid=0'" ) ]
3543 url : String ,
3644
37- #[ arg( long ) ]
45+ #[ arg( long, help = "Sheet name. \n Example: List1" ) ]
3846 tab : String ,
3947
40- #[ arg( long ) ]
41- cel : String ,
48+ #[ arg( long, help = "Cell id. You can set it in format:\n \
49+ - A1, where A is column name and 1 is row number\n \
50+ Example: --cell A4" ) ]
51+ cell : String ,
4252
43- #[ arg( long ) ]
53+ #[ arg( long, help = "Value you want to set. It can be written on any language. \n Example: --val hello" ) ]
4454 val : String
4555 }
4656 }
@@ -53,7 +63,7 @@ mod private
5363 {
5464 match commands
5565 {
56- Commands :: Get { url, tab, cel } =>
66+ Commands :: Get { url, tab, cell } =>
5767 {
5868 let spreadsheet_id = match get_spreadsheet_id_from_url ( url. as_str ( ) )
5969 {
@@ -70,16 +80,16 @@ mod private
7080 hub,
7181 spreadsheet_id,
7282 tab. as_str ( ) ,
73- cel . as_str ( )
83+ cell . as_str ( )
7484 )
7585 . await
7686 {
7787 Ok ( value ) => println ! ( "Value: {}" , value ) ,
78- Err ( error ) => println ! ( "Error: {}" , error ) ,
88+ Err ( error ) => println ! ( "Error:\n {}" , error ) ,
7989 }
8090 } ,
8191
82- Commands :: Set { url, tab, cel , val } =>
92+ Commands :: Set { url, tab, cell , val } =>
8393 {
8494 let spreadsheet_id = match get_spreadsheet_id_from_url ( url. as_str ( ) )
8595 {
@@ -96,7 +106,7 @@ mod private
96106 hub,
97107 spreadsheet_id,
98108 tab. as_str ( ) ,
99- cel . as_str ( ) ,
109+ cell . as_str ( ) ,
100110 val. as_str ( )
101111 )
102112 . await
0 commit comments