diff options
| author | Krasimir Angelov <kr.angelov@gmail.com> | 2022-05-31 10:15:50 +0200 |
|---|---|---|
| committer | Krasimir Angelov <kr.angelov@gmail.com> | 2022-05-31 10:15:50 +0200 |
| commit | b7672b67a39fb46f3ba8dbacca96babb04fca82c (patch) | |
| tree | 9bbeb683ca44fce3829c5bbc5eb5ff88f8817c26 | |
| parent | e33de168fd5b2ec27cfb7bc55da0e0ee39d481ac (diff) | |
adjust the -view command depending on the OS
| -rw-r--r-- | src/compiler/GF/Command/Commands.hs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/compiler/GF/Command/Commands.hs b/src/compiler/GF/Command/Commands.hs index 2f2e802e0..a6c66594f 100644 --- a/src/compiler/GF/Command/Commands.hs +++ b/src/compiler/GF/Command/Commands.hs @@ -4,6 +4,7 @@ module GF.Command.Commands ( options,flags, ) where import Prelude hiding (putStrLn,(<>)) -- GHC 8.4.1 clash with Text.PrettyPrint +import System.Info(os) import PGF @@ -882,11 +883,15 @@ pgfCommands = Map.fromList [ Right ty -> ty Nothing -> error ("Can't parse '"++str++"' as a type") optViewFormat opts = valStrOpts "format" "png" opts - optViewGraph opts = valStrOpts "view" "open" opts + optViewGraph opts = valStrOpts "view" open_cmd opts optNum opts = valIntOpts "number" 1 opts optNumInf opts = valIntOpts "number" 1000000000 opts ---- 10^9 takeOptNum opts = take (optNumInf opts) + open_cmd | os == "linux" = "xdg-open" + | os == "mingw32" = "start" + | otherwise = "open" + returnFromExprs es = return $ case es of [] -> pipeMessage "no trees found" _ -> fromExprs es @@ -1022,4 +1027,4 @@ stanzas = map unlines . chop . lines where #if !(MIN_VERSION_base(4,9,0)) errorWithoutStackTrace = error -#endif
\ No newline at end of file +#endif |
