Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions src/uu/pinky/locales/en-US.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,38 @@ pinky-about-musl-warning = Warning: When built with musl libc, the `pinky` utili
or missing user information due to musl's stub implementation of `utmpx`
functions. This limitation affects the ability to retrieve accurate details
about logged-in users.

# Long usage description
pinky-long-usage-description = A lightweight 'finger' program; print user information.
The utmp file will be

# Help messages
pinky-help-long-format = produce long format output for the specified USERs
pinky-help-omit-home-dir = omit the user's home directory and shell in long format
pinky-help-omit-project-file = omit the user's project file in long format
pinky-help-omit-plan-file = omit the user's plan file in long format
pinky-help-short-format = do short format output, this is the default
pinky-help-omit-headings = omit the line of column headings in short format
pinky-help-omit-name = omit the user's full name in short format
pinky-help-omit-name-host = omit the user's full name and remote host in short format
pinky-help-omit-name-host-time = omit the user's full name, remote host and idle time in short format
pinky-help-help = Print help information

# Column headers for short format
pinky-column-login = Login
pinky-column-name = Name
pinky-column-tty = TTY
pinky-column-idle = Idle
pinky-column-when = When
pinky-column-where = Where

# Labels for long format
pinky-login-name-label = Login name:
pinky-real-life-label = In real life:
pinky-directory-label = Directory:
pinky-shell-label = Shell:
pinky-project-label = Project:
pinky-plan-label = Plan

# Status messages
pinky-unsupported-openbsd = unsupported command on OpenBSD
41 changes: 41 additions & 0 deletions src/uu/pinky/locales/fr-FR.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
pinky-about = Affiche des informations brèves sur les utilisateurs des systèmes Unix
pinky-usage = pinky [OPTION]... [UTILISATEUR]...
pinky-about-musl-warning = Avertissement : Lorsque compilé avec musl libc, l'utilitaire `pinky` peut afficher des
informations utilisateur incomplètes ou manquantes en raison de l'implémentation
factice des fonctions `utmpx` de musl. Cette limitation affecte la capacité
à récupérer des détails précis sur les utilisateurs connectés.

# Description d'utilisation longue
pinky-long-usage-description = Un programme 'finger' léger ; affiche les informations utilisateur.
Le fichier utmp sera

# Messages d'aide
pinky-help-long-format = produire une sortie au format long pour les UTILISATEURS spécifiés
pinky-help-omit-home-dir = omettre le répertoire personnel et le shell de l'utilisateur en format long
pinky-help-omit-project-file = omettre le fichier projet de l'utilisateur en format long
pinky-help-omit-plan-file = omettre le fichier plan de l'utilisateur en format long
pinky-help-short-format = faire une sortie au format court, c'est le défaut
pinky-help-omit-headings = omettre la ligne des en-têtes de colonnes en format court
pinky-help-omit-name = omettre le nom complet de l'utilisateur en format court
pinky-help-omit-name-host = omettre le nom complet et l'hôte distant de l'utilisateur en format court
pinky-help-omit-name-host-time = omettre le nom complet, l'hôte distant et le temps d'inactivité de l'utilisateur en format court
pinky-help-help = Afficher les informations d'aide

# En-têtes de colonnes pour le format court
pinky-column-login = Connexion
pinky-column-name = Nom
pinky-column-tty = TTY
pinky-column-idle = Inactif
pinky-column-when = Quand
pinky-column-where = Où

# Étiquettes pour le format long
pinky-login-name-label = Nom de connexion :
pinky-real-life-label = Dans la vraie vie :
pinky-directory-label = Répertoire :
pinky-shell-label = Shell :
pinky-project-label = Projet :
pinky-plan-label = Plan

# Messages de statut
pinky-unsupported-openbsd = commande non supportée sur OpenBSD
20 changes: 10 additions & 10 deletions src/uu/pinky/src/pinky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,55 +44,55 @@ pub fn uu_app() -> Command {
Arg::new(options::LONG_FORMAT)
.short('l')
.requires(options::USER)
.help("produce long format output for the specified USERs")
.help(get_message("pinky-help-long-format"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_HOME_DIR)
.short('b')
.help("omit the user's home directory and shell in long format")
.help(get_message("pinky-help-omit-home-dir"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_PROJECT_FILE)
.short('h')
.help("omit the user's project file in long format")
.help(get_message("pinky-help-omit-project-file"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_PLAN_FILE)
.short('p')
.help("omit the user's plan file in long format")
.help(get_message("pinky-help-omit-plan-file"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::SHORT_FORMAT)
.short('s')
.help("do short format output, this is the default")
.help(get_message("pinky-help-short-format"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_HEADINGS)
.short('f')
.help("omit the line of column headings in short format")
.help(get_message("pinky-help-omit-headings"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_NAME)
.short('w')
.help("omit the user's full name in short format")
.help(get_message("pinky-help-omit-name"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_NAME_HOST)
.short('i')
.help("omit the user's full name and remote host in short format")
.help(get_message("pinky-help-omit-name-host"))
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::OMIT_NAME_HOST_TIME)
.short('q')
.help("omit the user's full name, remote host and idle time in short format")
.help(get_message("pinky-help-omit-name-host-time"))
.action(ArgAction::SetTrue),
)
.arg(
Expand All @@ -105,7 +105,7 @@ pub fn uu_app() -> Command {
// since that conflicts with omit_project_file.
Arg::new(options::HELP)
.long(options::HELP)
.help("Print help information")
.help(get_message("pinky-help-help"))
.action(ArgAction::Help),
)
}
Expand Down
6 changes: 2 additions & 4 deletions src/uu/pinky/src/platform/openbsd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
//
// For the full copyright and license information, please view the LICENSE
// file that was distributed with this source code.

// Specific implementation for OpenBSD: tool unsupported (utmpx not supported)

use crate::uu_app;

use uucore::error::UResult;
use uucore::locale::get_message;

pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let _matches = uu_app().try_get_matches_from(args)?;

println!("unsupported command on OpenBSD");
println!("{}", get_message("pinky-unsupported-openbsd"));
Ok(())
}
31 changes: 18 additions & 13 deletions src/uu/pinky/src/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use crate::uu_app;
use uucore::entries::{Locate, Passwd};
use uucore::error::{FromIo, UResult};
use uucore::libc::S_IWGRP;
use uucore::locale::get_message;
use uucore::utmpx::{self, Utmpx, time};

use std::io::BufReader;
Expand All @@ -24,8 +25,8 @@ use std::path::PathBuf;

fn get_long_usage() -> String {
format!(
"A lightweight 'finger' program; print user information.\n\
The utmp file will be {}.",
"{}{}",
get_message("pinky-long-usage-description"),
utmpx::DEFAULT_FILE
)
}
Expand Down Expand Up @@ -217,17 +218,17 @@ impl Pinky {
}

fn print_heading(&self) {
print!("{:<8}", "Login");
print!("{:<8}", get_message("pinky-column-login"));
if self.include_fullname {
print!(" {:<19}", "Name");
print!(" {:<19}", get_message("pinky-column-name"));
}
print!(" {:<9}", " TTY");
print!(" {:<9}", get_message("pinky-column-tty"));
if self.include_idle {
print!(" {:<6}", "Idle");
print!(" {:<6}", get_message("pinky-column-idle"));
}
print!(" {:<16}", "When");
print!(" {:<16}", get_message("pinky-column-when"));
if self.include_where {
print!(" Where");
print!(" {}", get_message("pinky-column-where"));
}
println!();
}
Expand All @@ -248,29 +249,33 @@ impl Pinky {

fn long_pinky(&self) {
for u in &self.names {
print!("Login name: {u:<28}In real life: ");
print!(
"{} {u:<28}{} ",
get_message("pinky-login-name-label"),
get_message("pinky-real-life-label")
);
if let Ok(pw) = Passwd::locate(u.as_str()) {
let fullname = gecos_to_fullname(&pw).unwrap_or_default();
let user_dir = pw.user_dir.unwrap_or_default();
let user_shell = pw.user_shell.unwrap_or_default();
println!(" {fullname}");
if self.include_home_and_shell {
print!("Directory: {user_dir:<29}");
println!("Shell: {user_shell}");
print!("{} {user_dir:<29}", get_message("pinky-directory-label"));
println!("{} {user_shell}", get_message("pinky-shell-label"));
}
if self.include_project {
let mut p = PathBuf::from(&user_dir);
p.push(".project");
if let Ok(f) = File::open(p) {
print!("Project: ");
print!("{} ", get_message("pinky-project-label"));
read_to_console(f);
}
}
if self.include_plan {
let mut p = PathBuf::from(&user_dir);
p.push(".plan");
if let Ok(f) = File::open(p) {
println!("Plan:");
println!("{}:", get_message("pinky-plan-label"));
read_to_console(f);
}
}
Expand Down
Loading