Commit cb5ddc1b authored by Michael Hanus 's avatar Michael Hanus

Small fixes in manual and programs

parent fd72bc3a
This diff is collapsed.
......@@ -360,7 +360,7 @@ search :: SearchOptions -> Config -> Repository -> IO (ErrorLogger ())
search (SearchOptions q) _ repo = putStr rendered >> succeedIO ()
where
rendered = if length results == 0
then "No packages found for '" ++ q ++ "'"
then "No packages found for '" ++ q ++ "'\n"
else render $ table columns [nameLen + 4, 76 - nameLen]
results = searchPackages repo q
header = [["Name", "Synopsis"], ["----", "--------"], [" ", " "]]
......@@ -414,8 +414,8 @@ exec o cfg repo gc = tryFindLocalPackageSpec "." |>=
newPackage :: IO (ErrorLogger ())
newPackage = do
putStrLn "Generate a new package"
putStrLn "----------------------"
putStrLn "Create a new package"
putStrLn "--------------------"
inpName <- askMandatory "What is the name of the new package?"
exists <- doesDirectoryExist inpName
if exists
......@@ -426,19 +426,22 @@ newPackage = do
Nothing -> putStrLn "Not a valid version!" >> exitWith 1
Just v -> return v
inpAuthor <- askMandatory "Who is the author of the package?"
inpSynopsis <- askMandatory "Please give me a short summary of what the package does."
inpSynopsis <- askMandatory
"Please provide a short (one line) summary of what the package does:\n>"
createDirectory inpName
pkgSpec <- return Package {
name = inpName
, version = inpVersion
, author = inpAuthor
, synopsis = inpSynopsis
, dependencies = []
, exportedModules = []
}
let pkgSpec = Package { name = inpName
, version = inpVersion
, author = inpAuthor
, synopsis = inpSynopsis
, dependencies = []
, exportedModules = []
}
writePackageSpec pkgSpec (inpName </> "package.json")
createDirectory (inpName </> "src")
putStrLn $ "I have created a new package for you in the '" ++ inpName ++ "' directory."
putStrLn $
"A new package in the directory '" ++ inpName ++ "' has been created.\n" ++
"Please go into this directory, add dependencies in 'package.json',\n" ++
"and run 'cpm install' to install all dependencies."
succeedIO ()
where
askMandatory question = do
......
......@@ -149,8 +149,9 @@ linkExists :: String -> IO Bool
linkExists target = do
dirExists <- doesDirectoryExist target
fileExists <- doesFileExist target
isLink <- isSymlink target
return $ (dirExists || fileExists) && isLink
if dirExists || fileExists
then isSymlink target
else return False
isDotOrDotDot :: String -> Bool
isDotOrDotDot s = case s of
......
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