mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-06 06:51:55 -07:00
X.P.Pass: Properly escape backslashes
This commit is contained in:
@@ -302,11 +302,12 @@ typeString cmd = cmd ++ " | head -n1 | tr -d '\n' | xdotool type --clearmodifier
|
|||||||
|
|
||||||
-- | Generate a pass prompt.
|
-- | Generate a pass prompt.
|
||||||
--
|
--
|
||||||
-- >>> pass "otp" "git\"hub\""
|
-- >>> pass "otp" "\\n'git'\"hub\""
|
||||||
-- "pass otp \"git\\\"hub\\\"\""
|
-- "pass otp \"\\\\n'git'\\\"hub\\\"\""
|
||||||
pass :: String -> String -> String
|
pass :: String -> String -> String
|
||||||
pass cmd label = concat ["pass ", cmd, " \"", concatMap escape label, "\""]
|
pass cmd label = concat ["pass ", cmd, " \"", concatMap escape label, "\""]
|
||||||
where
|
where
|
||||||
escape :: Char -> String
|
escape :: Char -> String
|
||||||
escape '"' = "\\\""
|
escape '"' = "\\\""
|
||||||
|
escape '\\' = "\\\\"
|
||||||
escape x = [x]
|
escape x = [x]
|
||||||
|
Reference in New Issue
Block a user