Merge pull request #45 from PaulJohnson/master

Provide help message.
This commit is contained in:
Avi Dessauer 2022-04-11 13:37:10 -04:00 committed by GitHub
commit b8ae867d05
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -9,7 +9,9 @@ import Hie.Locate
import Hie.Yaml
import System.Directory
import System.Environment
import System.Exit
import System.FilePath.Posix
import System.IO
main :: IO ()
main = do
@ -19,8 +21,8 @@ main = do
"cabal" -> cabalPkgs pwd
_ -> stackYamlPkgs pwd
when (null cfs) $
error $
"Used" <> name
die $
"Used " <> name
<> "\n No .cabal files found under"
<> pwd
<> "\n You may need to run stack build."
@ -31,6 +33,16 @@ resolveName :: FilePath -> IO String
resolveName pwd = do
args <- getArgs
files <- listDirectory pwd
when ("--help" `elem` args || "-h" `elem` args) $ do
progName <- getProgName
hPutStrLn stderr $
"Usage: " <> progName
<> " [ --cabal | --stack ]\n\n\
\If neither argument is given then "
<> progName
<> " will infer the type by\n\
\looking for dist-newstyle, .stack-work, cabal.project and stack.yaml in that order."
exitSuccess
let fileNames = map takeFileName files
name =
if