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:
parent
d70f1df876
commit
afa6afe94e
4 changed files with 7 additions and 7 deletions
|
@ -28,8 +28,8 @@ library:
|
||||||
- plist
|
- plist
|
||||||
- prettyprinter
|
- prettyprinter
|
||||||
- prettyprinter-ansi-terminal
|
- prettyprinter-ansi-terminal
|
||||||
- process
|
|
||||||
- text
|
- text
|
||||||
|
- typed-process
|
||||||
|
|
||||||
executables:
|
executables:
|
||||||
prefmanager:
|
prefmanager:
|
||||||
|
|
|
@ -4,7 +4,7 @@ cabal-version: 1.12
|
||||||
--
|
--
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
--
|
--
|
||||||
-- hash: 1a8cff5464ff5ded24a399492c6be76412d42e1e21780bb40565735f140afab2
|
-- hash: f6c3525e0baa5d12b8726a3fb2e8555c5e71a4604b8cccf146af041be3186c93
|
||||||
|
|
||||||
name: prefmanager
|
name: prefmanager
|
||||||
version: 0.1.0.0
|
version: 0.1.0.0
|
||||||
|
@ -46,9 +46,9 @@ library
|
||||||
, plist
|
, plist
|
||||||
, prettyprinter
|
, prettyprinter
|
||||||
, prettyprinter-ansi-terminal
|
, prettyprinter-ansi-terminal
|
||||||
, process
|
|
||||||
, relude
|
, relude
|
||||||
, text
|
, text
|
||||||
|
, typed-process
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
executable prefmanager
|
executable prefmanager
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{ mkDerivation, ansi-terminal, async, base-noprelude, containers
|
{ mkDerivation, ansi-terminal, async, base-noprelude, containers
|
||||||
, hpack, hxt, optparse-applicative, patience, plist, prettyprinter
|
, hpack, hxt, optparse-applicative, patience, plist, prettyprinter
|
||||||
, prettyprinter-ansi-terminal, process, relude, stdenv, text
|
, prettyprinter-ansi-terminal, relude, stdenv, text, typed-process
|
||||||
}:
|
}:
|
||||||
mkDerivation {
|
mkDerivation {
|
||||||
pname = "prefmanager";
|
pname = "prefmanager";
|
||||||
|
@ -10,7 +10,7 @@ mkDerivation {
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
libraryHaskellDepends = [
|
libraryHaskellDepends = [
|
||||||
ansi-terminal async base-noprelude containers hxt patience plist
|
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 ];
|
libraryToolDepends = [ hpack ];
|
||||||
executableHaskellDepends = [ base-noprelude optparse-applicative ];
|
executableHaskellDepends = [ base-noprelude optparse-applicative ];
|
||||||
|
|
|
@ -16,13 +16,13 @@ import Patience.Map (diff, isSame, toDelta)
|
||||||
import Prettyprinter.Render.Terminal (putDoc)
|
import Prettyprinter.Render.Terminal (putDoc)
|
||||||
import System.Console.ANSI (clearLine, setCursorColumn)
|
import System.Console.ANSI (clearLine, setCursorColumn)
|
||||||
import System.IO (hFlush)
|
import System.IO (hFlush)
|
||||||
import System.Process (shell, readCreateProcess)
|
|
||||||
import Text.XML.HXT.Core (no, withSubstDTDEntities, withValidate)
|
import Text.XML.HXT.Core (no, withSubstDTDEntities, withValidate)
|
||||||
import Text.XML.Plist (PlObject, fromPlDict, readPlistFromString)
|
import Text.XML.Plist (PlObject, fromPlDict, readPlistFromString)
|
||||||
|
import System.Process.Typed (shell, readProcessStdout_)
|
||||||
|
|
||||||
-- | Convenience function for running macOS @defaults@ command.
|
-- | Convenience function for running macOS @defaults@ command.
|
||||||
defaultsCmd :: Text -> IO Text
|
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
|
-- | Convenience function for parsing Plist strings
|
||||||
parsePlist :: Text -> IO PlObject
|
parsePlist :: Text -> IO PlObject
|
||||||
|
|
Loading…
Reference in a new issue