projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
distclean: ghcprof-inplace
[ghc-hetmet.git]
/
utils
/
ghc-pkg
/
Main.hs
diff --git
a/utils/ghc-pkg/Main.hs
b/utils/ghc-pkg/Main.hs
index
29e2c8d
..
8c106b0
100644
(file)
--- a/
utils/ghc-pkg/Main.hs
+++ b/
utils/ghc-pkg/Main.hs
@@
-99,6
+99,7
@@
data Flag
| FlagAutoGHCiLibs
| FlagDefinedName String String
| FlagSimpleOutput
| FlagAutoGHCiLibs
| FlagDefinedName String String
| FlagSimpleOutput
+ | FlagNamesOnly
deriving Eq
flags :: [OptDescr Flag]
deriving Eq
flags :: [OptDescr Flag]
@@
-124,7
+125,9
@@
flags = [
Option ['V'] ["version"] (NoArg FlagVersion)
"output version information and exit",
Option [] ["simple-output"] (NoArg FlagSimpleOutput)
Option ['V'] ["version"] (NoArg FlagVersion)
"output version information and exit",
Option [] ["simple-output"] (NoArg FlagSimpleOutput)
- "print output in easy-to-parse format for some commands"
+ "print output in easy-to-parse format for some commands",
+ Option [] ["names-only"] (NoArg FlagNamesOnly)
+ "only print package names, not versions; can only be used with list --simple-output"
]
where
toDefined str =
]
where
toDefined str =
@@
-491,7
+494,9
@@
listPackages flags mPackageName = do
where doc = text (showPackageId (package p))
show_simple db_stack = do
where doc = text (showPackageId (package p))
show_simple db_stack = do
- let pkgs = map showPackageId $ sortBy compPkgIdVer $
+ let showPkg = if FlagNamesOnly `elem` flags then pkgName
+ else showPackageId
+ pkgs = map showPkg $ sortBy compPkgIdVer $
map package (concatMap snd db_stack)
when (null pkgs) $ die "no matches"
hPutStrLn stdout $ concat $ intersperse " " pkgs
map package (concatMap snd db_stack)
when (null pkgs) $ die "no matches"
hPutStrLn stdout $ concat $ intersperse " " pkgs
@@
-1020,7
+1025,10
@@
dieForcible s = die (s ++ " (use --force to override)")
-- Cut and pasted from ghc/compiler/SysTools
#if defined(mingw32_HOST_OS)
-- Cut and pasted from ghc/compiler/SysTools
#if defined(mingw32_HOST_OS)
+subst :: Char -> Char -> String -> String
subst a b ls = map (\ x -> if x == a then b else x) ls
subst a b ls = map (\ x -> if x == a then b else x) ls
+
+unDosifyPath :: FilePath -> FilePath
unDosifyPath xs = subst '\\' '/' xs
getExecDir :: String -> IO (Maybe String)
unDosifyPath xs = subst '\\' '/' xs
getExecDir :: String -> IO (Maybe String)