|
7 | 7 | // |
8 | 8 |
|
9 | 9 | use clap::{error::ErrorKind, Parser}; |
10 | | -use gettextrs::{bind_textdomain_codeset, setlocale, textdomain, LocaleCategory}; |
| 10 | +use gettextrs::{bind_textdomain_codeset, gettext, setlocale, textdomain, LocaleCategory}; |
11 | 11 | use plib::PROJECT_NAME; |
12 | 12 | use thiserror::Error; |
13 | 13 |
|
@@ -35,6 +35,16 @@ use std::{ |
35 | 35 | time::{Duration, Instant}, |
36 | 36 | }; |
37 | 37 |
|
| 38 | +#[derive(Parser)] |
| 39 | +#[command(version, about=gettext("talk - talk to another user"))] |
| 40 | +struct Args { |
| 41 | + #[arg(help = gettext("Address to connect or listen to"))] |
| 42 | + address: String, |
| 43 | + |
| 44 | + #[arg(help = gettext("Terminal name to use (optional)"))] |
| 45 | + ttyname: Option<String>, |
| 46 | +} |
| 47 | + |
38 | 48 | /// A static variable to hold the state of delete invitations on SIGINT signal. |
39 | 49 | static DELETE_INVITATIONS: LazyLock< |
40 | 50 | Arc<Mutex<Option<(Vec<u8>, Vec<u8>, Arc<UdpSocket>, SocketAddr)>>>, |
@@ -362,17 +372,6 @@ impl CtlRes { |
362 | 372 | } |
363 | 373 | } |
364 | 374 |
|
365 | | -/// talk - talk to another user |
366 | | -#[derive(Parser, Debug)] |
367 | | -#[command(author, version, about, long_about)] |
368 | | -struct Args { |
369 | | - /// Address to connect or listen to |
370 | | - address: String, |
371 | | - |
372 | | - /// Terminal name to use (optional) |
373 | | - ttyname: Option<String>, |
374 | | -} |
375 | | - |
376 | 375 | fn talk(args: Args) -> Result<(), TalkError> { |
377 | 376 | let mut msg = CtlMsg::default(); |
378 | 377 | let mut res = CtlRes::default(); |
|
0 commit comments