From a62fa84b0bb5abe3a2c52a047f47b6403ffcd54c Mon Sep 17 00:00:00 2001 From: Justin Wernick Date: Mon, 20 Mar 2023 23:34:50 +0200 Subject: Move user info gathering to its own workspace crate --- src/git.rs | 2 +- src/lib.rs | 1 - src/user.rs | 7 ------- 3 files changed, 1 insertion(+), 9 deletions(-) delete mode 100644 src/user.rs (limited to 'src') diff --git a/src/git.rs b/src/git.rs index 753f53a..24b376d 100644 --- a/src/git.rs +++ b/src/git.rs @@ -1,10 +1,10 @@ use crate::{ parser::{GitReceivePackArgs, GitUploadPackArgs}, - user::get_username, ShackleError, }; use git2::{Repository, RepositoryInitOptions}; use std::{path::PathBuf, process::Command}; +use user_info::get_username; pub struct GitInitResult { pub path: PathBuf, diff --git a/src/lib.rs b/src/lib.rs index b645918..99d8877 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,5 @@ pub mod git; pub mod parser; -pub mod user; use parser::*; use rustyline::error::ReadlineError; diff --git a/src/user.rs b/src/user.rs deleted file mode 100644 index 72aea8d..0000000 --- a/src/user.rs +++ /dev/null @@ -1,7 +0,0 @@ -pub fn get_username() -> Option { - let uid = nix::unistd::getuid(); - nix::unistd::User::from_uid(uid) - .ok() - .flatten() - .map(|user| user.name) -} -- cgit v1.2.3