@@ -19,17 +19,18 @@ fn main() -> Result<()> {
1919 . subcommand (
2020 SubCommand :: with_name ( "mutt-query" )
2121 . about ( "Search for contact, output is usable for mutt's query_command." )
22- . arg ( Arg :: with_name ( "query" ) . index ( 1 ) ) ,
22+ . arg ( Arg :: with_name ( "disable-empty-line" ) . long ( "disable-empty-line" ) . help ( "Disable printing an empty first line" ) )
23+ . arg ( Arg :: with_name ( "query" ) . required ( true ) ) ,
2324 )
2425 . subcommand (
2526 SubCommand :: with_name ( "file-query" )
2627 . about ( "Search for contact, return just the filename." )
27- . arg ( Arg :: with_name ( "query" ) . index ( 1 ) ) ,
28+ . arg ( Arg :: with_name ( "query" ) . required ( true ) ) ,
2829 )
2930 . subcommand (
3031 SubCommand :: with_name ( "email-query" )
3132 . about ( "Search for contact, return \" name <email>\" ." )
32- . arg ( Arg :: with_name ( "query" ) . index ( 1 ) ) ,
33+ . arg ( Arg :: with_name ( "query" ) . required ( true ) ) ,
3334 )
3435 . subcommand (
3536 SubCommand :: with_name ( "add" )
@@ -38,7 +39,7 @@ fn main() -> Result<()> {
3839 . subcommand (
3940 SubCommand :: with_name ( "edit" )
4041 . about ( "Open contact (given by filepath or search-string) interactively." )
41- . arg ( Arg :: with_name ( "file-or-query" ) . index ( 1 ) ) ,
42+ . arg ( Arg :: with_name ( "file-or-query" ) . required ( true ) ) ,
4243 )
4344 . get_matches ( ) ;
4445
@@ -50,25 +51,25 @@ fn main() -> Result<()> {
5051 } ;
5152
5253 match app. subcommand ( ) {
53- ( "index" , Some ( _subs ) ) => {
54+ ( "index" , Some ( _args ) ) => {
5455 println ! (
5556 "Rebuilding index file \" {}\" ..." ,
5657 config. index_path. display( )
5758 ) ;
5859 cli:: build_index ( & config. index_path , & config. vdir_path ) ?;
5960 }
60- ( "mutt-query" , Some ( subs ) ) => {
61- if let Some ( value) = subs . value_of ( "query" ) {
62- cli:: mutt_query ( & config, value) ?
61+ ( "mutt-query" , Some ( args ) ) => {
62+ if let Some ( value) = args . value_of ( "query" ) {
63+ cli:: mutt_query ( & config, args . is_present ( "disable-empty-line" ) , value) ?
6364 }
6465 }
65- ( "file-query" , Some ( subs ) ) => {
66- if let Some ( value) = subs . value_of ( "query" ) {
66+ ( "file-query" , Some ( args ) ) => {
67+ if let Some ( value) = args . value_of ( "query" ) {
6768 cli:: file_query ( & config, value) ?
6869 }
6970 }
70- ( "email-query" , Some ( subs ) ) => {
71- if let Some ( value) = subs . value_of ( "query" ) {
71+ ( "email-query" , Some ( args ) ) => {
72+ if let Some ( value) = args . value_of ( "query" ) {
7273 cli:: email_query ( & config, value) ?
7374 }
7475 }
@@ -87,8 +88,8 @@ fn main() -> Result<()> {
8788 let index_entry = utils:: index_item_from_contact ( & contact) ?;
8889 index_fp. write_all ( index_entry. as_bytes ( ) ) ?;
8990 }
90- ( "edit" , Some ( subs ) ) => {
91- if let Some ( value) = subs . value_of ( "file-or-query" ) {
91+ ( "edit" , Some ( args ) ) => {
92+ if let Some ( value) = args . value_of ( "file-or-query" ) {
9293 cli:: edit_contact ( & config, value) ?
9394 }
9495 }
0 commit comments