diff options
author | Justin Wernick <justin@worthe-it.co.za> | 2023-03-20 23:34:50 +0200 |
---|---|---|
committer | Justin Wernick <justin@worthe-it.co.za> | 2023-03-20 23:34:50 +0200 |
commit | a62fa84b0bb5abe3a2c52a047f47b6403ffcd54c (patch) | |
tree | 7efd7e60d5d046b1239c91beb3e9d9cc45e9839e /src | |
parent | 2b827a0ab06fb715290a0450a3fff56d3e6f4ee6 (diff) |
Move user info gathering to its own workspace crate
Diffstat (limited to 'src')
-rw-r--r-- | src/git.rs | 2 | ||||
-rw-r--r-- | src/lib.rs | 1 | ||||
-rw-r--r-- | src/user.rs | 7 |
3 files changed, 1 insertions, 9 deletions
@@ -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, @@ -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<String> { - let uid = nix::unistd::getuid(); - nix::unistd::User::from_uid(uid) - .ok() - .flatten() - .map(|user| user.name) -} |