[commit: ghc] master: GHCi: Implement new `:show paths` sub-command (56e28a3)
git at git.haskell.org
git at git.haskell.org
Tue Aug 27 23:37:54 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/56e28a3fbb7f911e27feac9499f3204d739eead0/ghc
>---------------------------------------------------------------
commit 56e28a3fbb7f911e27feac9499f3204d739eead0
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sun Aug 25 10:22:45 2013 +0200
GHCi: Implement new `:show paths` sub-command
`:show paths` dumps the current working directory as well
as the current value of the `importPaths` dynamic flags field.
This addresses #8172
Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>
>---------------------------------------------------------------
56e28a3fbb7f911e27feac9499f3204d739eead0
ghc/InteractiveUI.hs | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/ghc/InteractiveUI.hs b/ghc/InteractiveUI.hs
index 91648a3..d982692 100644
--- a/ghc/InteractiveUI.hs
+++ b/ghc/InteractiveUI.hs
@@ -315,6 +315,7 @@ defFullHelpText =
" :show linker show current linker state\n" ++
" :show modules show the currently loaded modules\n" ++
" :show packages show the currently active package flags\n" ++
+ " :show paths show the currently active search paths\n" ++
" :show language show the currently active language flags\n" ++
" :show <setting> show value of <setting>, which is one of\n" ++
" [args, prog, prompt, editor, stop]\n" ++
@@ -2156,6 +2157,7 @@ showCmd str = do
["breaks"] -> showBkptTable
["context"] -> showContext
["packages"] -> showPackages
+ ["paths"] -> showPaths
["languages"] -> showLanguages -- backwards compat
["language"] -> showLanguages
["lang"] -> showLanguages -- useful abbreviation
@@ -2263,6 +2265,19 @@ showPackages = do
showFlag (TrustPackage p) = text $ " -trust " ++ p
showFlag (DistrustPackage p) = text $ " -distrust " ++ p
+showPaths :: GHCi ()
+showPaths = do
+ dflags <- getDynFlags
+ liftIO $ do
+ cwd <- getCurrentDirectory
+ putStrLn $ showSDoc dflags $
+ text "current working directory: " $$
+ nest 2 (text cwd)
+ let ipaths = importPaths dflags
+ putStrLn $ showSDoc dflags $
+ text ("module import search paths:"++if null ipaths then " none" else "") $$
+ nest 2 (vcat (map text ipaths))
+
showLanguages :: GHCi ()
showLanguages = getDynFlags >>= liftIO . showLanguages' False
@@ -2423,7 +2438,7 @@ completeShowOptions = wrapCompleter flagWordBreakChars $ \w -> do
return (filter (w `isPrefixOf`) opts)
where opts = ["args", "prog", "prompt", "prompt2", "editor", "stop",
"modules", "bindings", "linker", "breaks",
- "context", "packages", "language", "imports"]
+ "context", "packages", "paths", "language", "imports"]
completeShowiOptions = wrapCompleter flagWordBreakChars $ \w -> do
return (filter (w `isPrefixOf`) ["language"])
More information about the ghc-commits
mailing list