Commit 84bdb14a authored by Michael Hanus 's avatar Michael Hanus

Options "list --csv" and "info --all" added

parent df969340
......@@ -400,15 +400,18 @@ more output.
\item[\fbox{\code{info}}] Gives information on the current package, e.g. the
package's name, author, synopsis and its dependency specifications.
\item[\fbox{\code{info $package$}}] Gives information on the newest known
version of the given package.
\item[\fbox{\code{info $package$ [--all]}}]
Prints information on the newest known version of the given package.
The option \code{--all} shows more information.
\item[\fbox{\code{info $package$ $version$}}] Gives information on the given
package version.
\item[\fbox{\code{info $package$ $version$ [--all]}}]
Prints basic information on the given package version.
The option \code{--all} shows more information.
\item[\fbox{\code{list [--all]}}] List the names and synopses of all
packages in the central package index. The option \verb|--all| shows
also all package versions.
\item[\fbox{\code{list [--all] [--csv]}}] List the names and synopses of all
packages in the central package index.
The option \code{--all} shows also all package versions.
The option \code{--csv} shows the information in CSV format.
\item[\fbox{\code{search $query$}}] Searches the names and synopses of all
packages in the central package index for a term.
......@@ -552,7 +555,7 @@ an empty JSON object, the package is assumed to be compatible to all compilers
in all versions.
\item[\fbox{\code{source}}] A JSON object specifying where the version of the
package described in the specification ca be obtained. See
package described in the specification can be obtained. See
Section~\ref{sec:publishing-a-package} for details.
\item[\fbox{\code{exportedModules}}] A list of modules intended for use by
......
......@@ -193,7 +193,7 @@ callCurryCheck info baseTmp funcs = do
let currybin = installDir </> "bin" </> "curry"
currypath = infDirA info ++ ":" ++ infDirB info
setEnviron "CURRYPATH" currypath
log Debug "Run `curry check Compare' with" |>
log Debug ("Run `curry check Compare' in `" ++ baseTmp ++ "' with") |>
log Debug ("CURRYPATH=" ++ currypath) |> succeedIO ()
inDirectory baseTmp $ system (currybin ++ " check Compare")
setEnviron "CURRYPATH" oldPath
......
This diff is collapsed.
......@@ -36,7 +36,8 @@ import CPM.ErrorLogger
import qualified CPM.PackageCache.Global as GC
import qualified CPM.PackageCache.Runtime as RuntimeCache
import qualified CPM.PackageCache.Local as LocalCache
import CPM.Package (Package (source, version, author, synopsis, dependencies, description, name)
import CPM.Package (Package (source, version, author, synopsis, dependencies
, description, name, exportedModules)
, readPackageSpec, packageId, readVersion, Version
, showVersion, PackageSource (..), showDependency
, Dependency, GitRevision (..), packageIdEq, loadPackageSpec)
......@@ -190,23 +191,41 @@ resolveDependencies cfg repo gc dir = loadPackageSpec dir |->
\pkgSpec -> resolveDependenciesForPackageCopy cfg pkgSpec repo gc dir
--- Renders information on a package.
renderPackageInfo :: Repository -> GC.GlobalCache -> Package -> String
renderPackageInfo _ gc pkg = pPrint doc
renderPackageInfo :: Bool -> Repository -> GC.GlobalCache -> Package -> String
renderPackageInfo allinfos _ gc pkg = pPrint doc
where
maxLen = 12
doc = vcat [heading, rule, installed, ver, auth, synop, deps, descr]
doc = vcat $ [heading, rule, installed, ver, auth, synop, deps, descr] ++
if allinfos then [expmods, src] else []
pkgId = packageId pkg
isInstalled = GC.isPackageInstalled gc pkg
heading = text pkgId
installed = if isInstalled then empty else red $ text "Not installed"
rule = text (take (length pkgId) $ repeat '-')
ver = fill maxLen (bold (text "Version")) <+>
(text $ showVersion $ version pkg)
auth = fill maxLen (bold (text "Author")) <+> (text $ author pkg)
synop = fill maxLen (bold (text "Synopsis")) <+> (text $ synopsis pkg)
deps = (bold $ text "Dependencies") <$$>
(vcat $ map (indent 4 . text . showDependency) $ dependencies pkg)
rule = text (take (length pkgId) $ repeat '-')
ver = fill maxLen (bold (text "Version")) <+>
(text $ showVersion $ version pkg)
auth = fill maxLen (bold (text "Author")) <+> (text $ author pkg)
synop = fill maxLen (bold (text "Synopsis")) <+> (text $ synopsis pkg)
deps = (bold $ text "Dependencies") <$$>
(vcat $ map (indent 4 . text . showDependency) $ dependencies pkg)
descr = case description pkg of
Nothing -> empty
Just d -> (bold $ text "Description") <$$>
(indent 4 (fillSep (map text (words d))))
src = case source pkg of
Nothing -> empty
Just (Http s) -> (bold $ text "Source") <$$>
(indent 4 (text s))
Just (Git s _) -> (bold $ text "Source") <$$>
(indent 4 (text s))
Just (FileSource s) -> (bold $ text "Source") <$$>
(indent 4 (text s))
expmods =
if null (exportedModules pkg)
then empty
else (bold $ text "Exported modules") <$$>
(indent 4 (fillSep (map text (exportedModules pkg))))
......@@ -130,12 +130,12 @@ updateRepository cfg = do
c <- inDirectory (repositoryDir cfg) $ system $ "git pull origin master"
if c == 0
then log Info "Successfully updated repository"
else failIO $ "Failed to update git repository, return code " ++ (show c)
else failIO $ "Failed to update git repository, return code " ++ show c
else do
c <- inDirectory (repositoryDir cfg) $ system $ cloneCommand
if c == 0
then log Info "Successfully updated repository"
else failIO $ "Failed to update git repository, return code " ++ (show c)
else failIO $ "Failed to update git repository, return code " ++ show c
where
cloneCommand = "git clone " ++ (packageIndexRepository cfg) ++ " ."
cloneCommand = "git clone " ++ packageIndexRepository cfg ++ " ."
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment