Escape string for the shell
This commit is contained in:
parent
bbb9fd83ae
commit
c744144b36
@ -28,5 +28,5 @@ executable skeleton
|
|||||||
TypeSynonymInstances
|
TypeSynonymInstances
|
||||||
build-depends: base >=4.8 && <= 5.0, filepath, process,
|
build-depends: base >=4.8 && <= 5.0, filepath, process,
|
||||||
attoparsec, bytestring, hex, time,
|
attoparsec, bytestring, hex, time,
|
||||||
argparser
|
argparser, posix-escape
|
||||||
ghc-options: -O2
|
ghc-options: -O2
|
||||||
|
@ -8,6 +8,7 @@ import Control.Monad (when)
|
|||||||
import Data.List (isInfixOf)
|
import Data.List (isInfixOf)
|
||||||
import System.FilePath (takeBaseName)
|
import System.FilePath (takeBaseName)
|
||||||
import System.Process (readProcess, callCommand)
|
import System.Process (readProcess, callCommand)
|
||||||
|
import System.Posix.Escape (escape)
|
||||||
import System.Console.ArgParser
|
import System.Console.ArgParser
|
||||||
|
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ getKeychain paths = do
|
|||||||
|
|
||||||
sendClipboard :: String -> IO ()
|
sendClipboard :: String -> IO ()
|
||||||
sendClipboard text =
|
sendClipboard text =
|
||||||
callCommand $ "echo " ++ (show text) ++ " | pbcopy"
|
callCommand $ "echo " ++ (escape text) ++ " | pbcopy"
|
||||||
|
|
||||||
|
|
||||||
-- CLI arguments --
|
-- CLI arguments --
|
||||||
|
Loading…
Reference in New Issue
Block a user