assistant: Detect when system is not configured with a user name, and set environment to prevent git from failing.
This commit is contained in:
parent
24df1f6ee0
commit
13d2fffb2d
4 changed files with 35 additions and 1 deletions
|
@ -7,7 +7,8 @@
|
|||
|
||||
module Utility.UserInfo (
|
||||
myHomeDir,
|
||||
myUserName
|
||||
myUserName,
|
||||
myUserGecos,
|
||||
) where
|
||||
|
||||
import Control.Applicative
|
||||
|
@ -24,6 +25,9 @@ myHomeDir = myVal ["HOME"] homeDirectory
|
|||
myUserName :: IO String
|
||||
myUserName = myVal ["USER", "LOGNAME"] userName
|
||||
|
||||
myUserGecos :: IO String
|
||||
myUserGecos = myVal [] userGecos
|
||||
|
||||
myVal :: [String] -> (UserEntry -> String) -> IO String
|
||||
myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars
|
||||
where
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue