summaryrefslogtreecommitdiff
path: root/Command/Map.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-11-30 12:50:49 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-11-30 12:50:49 -0400
commit8cbab786bb7592fda2253b1c0d71c9c025e9984b (patch)
tree331b26bcae0f2fb85af37f373adb804b9ca7b5c7 /Command/Map.hs
parenta5134d6f3fe92f9a24b7459eda648ee443c70cc1 (diff)
prefer xdot over dot
* map: Run xdot if it's available in PATH. On OSX, the dot command does not support graphical display, while xdot does. * Debian: xdot is a better interactive viewer than dot, so Suggest xdot, rather than graphviz.
Diffstat (limited to 'Command/Map.hs')
-rw-r--r--Command/Map.hs24
1 files changed, 17 insertions, 7 deletions
diff --git a/Command/Map.hs b/Command/Map.hs
index 2b21c40ba..43c00d257 100644
--- a/Command/Map.hs
+++ b/Command/Map.hs
@@ -47,15 +47,25 @@ start = do
liftIO $ writeFile file (drawMap rs trustmap umap)
next $ next $
ifM (Annex.getState Annex.fast)
- ( do
- showLongNote $ "left map in " ++ file
- return True
- , do
- showLongNote $ "running: dot -Tx11 " ++ file
- showOutput
- liftIO $ boolSystem "dot" [Param "-Tx11", File file]
+ ( runViewer file []
+ , runViewer file
+ [ ("xdot", [File file])
+ , ("dot", [Param "-Tx11", File file])
+ ]
)
+runViewer :: FilePath -> [(String, [CommandParam])] -> Annex Bool
+runViewer file [] = do
+ showLongNote $ "left map in " ++ file
+ return True
+runViewer file ((c, ps):rest) = ifM (liftIO $ inPath c)
+ ( do
+ showLongNote $ "running: " ++ c ++ unwords (toCommand ps)
+ showOutput
+ liftIO $ boolSystem c ps
+ , runViewer file rest
+ )
+
{- Generates a graph for dot(1). Each repository, and any other uuids
- (except for dead ones), are displayed as a node, and each of its
- remotes is represented as an edge pointing at the node for the remote.