aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/Main.hs10
-rw-r--r--app/Process.hs7
2 files changed, 8 insertions, 9 deletions
diff --git a/app/Main.hs b/app/Main.hs
index bfe634c..9e838c8 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -88,7 +88,7 @@ import Options.Applicative ((<**>))
import Options.Applicative qualified as O
import Prettyprinter qualified as P
import Prettyprinter.Render.Terminal qualified as P
-import Process (sh, sh_)
+import Process (sh, sh_, quote)
import System.Exit (ExitCode (ExitFailure), exitWith)
import System.FilePath qualified as F
import System.Process.Typed qualified as P
@@ -316,11 +316,3 @@ getFiles files =
)
)
)
- where
-
-quote :: String -> String
-quote s = "'" ++ escape s ++ "'"
- where
- escape [] = []
- escape ('\'' : cs) = '\\' : '\'' : escape cs
- escape (c : cs) = c : escape cs
diff --git a/app/Process.hs b/app/Process.hs
index 39132d4..ecc9cd3 100644
--- a/app/Process.hs
+++ b/app/Process.hs
@@ -23,3 +23,10 @@ sh_ proc = do
if exitCode == ExitSuccess
then pure ()
else throwIO $ ProcessException (show proc) exitCode err
+
+quote :: String -> String
+quote s = "'" ++ escape s ++ "'"
+ where
+ escape [] = []
+ escape ('\'' : cs) = '\'' : '\\' : '\'' : '\'' : escape cs
+ escape (c : cs) = c : escape cs