Skip to content

Commit bfc1d56

Browse files
committed
talk: args cleanups
1 parent cd8225d commit bfc1d56

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

users/talk.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
use clap::{error::ErrorKind, Parser};
10-
use gettextrs::{bind_textdomain_codeset, setlocale, textdomain, LocaleCategory};
10+
use gettextrs::{bind_textdomain_codeset, gettext, setlocale, textdomain, LocaleCategory};
1111
use plib::PROJECT_NAME;
1212
use thiserror::Error;
1313

@@ -35,6 +35,16 @@ use std::{
3535
time::{Duration, Instant},
3636
};
3737

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+
3848
/// A static variable to hold the state of delete invitations on SIGINT signal.
3949
static DELETE_INVITATIONS: LazyLock<
4050
Arc<Mutex<Option<(Vec<u8>, Vec<u8>, Arc<UdpSocket>, SocketAddr)>>>,
@@ -362,17 +372,6 @@ impl CtlRes {
362372
}
363373
}
364374

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-
376375
fn talk(args: Args) -> Result<(), TalkError> {
377376
let mut msg = CtlMsg::default();
378377
let mut res = CtlRes::default();

0 commit comments

Comments
 (0)