1
0
Fork 0
mirror of https://github.com/malob/prefmanager.git synced 2024-12-14 11:57:49 +00:00

Switch from using process to typed-process

This commit is contained in:
Malo Bourgon 2021-01-29 13:42:02 -08:00
parent d70f1df876
commit afa6afe94e
4 changed files with 7 additions and 7 deletions

View file

@ -28,8 +28,8 @@ library:
- plist
- prettyprinter
- prettyprinter-ansi-terminal
- process
- text
- typed-process
executables:
prefmanager:

View file

@ -4,7 +4,7 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
-- hash: 1a8cff5464ff5ded24a399492c6be76412d42e1e21780bb40565735f140afab2
-- hash: f6c3525e0baa5d12b8726a3fb2e8555c5e71a4604b8cccf146af041be3186c93
name: prefmanager
version: 0.1.0.0
@ -46,9 +46,9 @@ library
, plist
, prettyprinter
, prettyprinter-ansi-terminal
, process
, relude
, text
, typed-process
default-language: Haskell2010
executable prefmanager

View file

@ -1,6 +1,6 @@
{ mkDerivation, ansi-terminal, async, base-noprelude, containers
, hpack, hxt, optparse-applicative, patience, plist, prettyprinter
, prettyprinter-ansi-terminal, process, relude, stdenv, text
, prettyprinter-ansi-terminal, relude, stdenv, text, typed-process
}:
mkDerivation {
pname = "prefmanager";
@ -10,7 +10,7 @@ mkDerivation {
isExecutable = true;
libraryHaskellDepends = [
ansi-terminal async base-noprelude containers hxt patience plist
prettyprinter prettyprinter-ansi-terminal process relude text
prettyprinter prettyprinter-ansi-terminal relude text typed-process
];
libraryToolDepends = [ hpack ];
executableHaskellDepends = [ base-noprelude optparse-applicative ];

View file

@ -16,13 +16,13 @@ import Patience.Map (diff, isSame, toDelta)
import Prettyprinter.Render.Terminal (putDoc)
import System.Console.ANSI (clearLine, setCursorColumn)
import System.IO (hFlush)
import System.Process (shell, readCreateProcess)
import Text.XML.HXT.Core (no, withSubstDTDEntities, withValidate)
import Text.XML.Plist (PlObject, fromPlDict, readPlistFromString)
import System.Process.Typed (shell, readProcessStdout_)
-- | Convenience function for running macOS @defaults@ command.
defaultsCmd :: Text -> IO Text
defaultsCmd (toString -> t) = toText <$> readCreateProcess (shell $ "/usr/bin/defaults " <> t) ""
defaultsCmd (toString -> t) = decodeUtf8 <$> readProcessStdout_ (shell $ "/usr/bin/defaults " <> t)
-- | Convenience function for parsing Plist strings
parsePlist :: Text -> IO PlObject