mirror of
https://github.com/Avi-D-coder/implicit-hie.git
synced 2024-11-26 00:04:23 +03:00
commit
b8ae867d05
16
app/Main.hs
16
app/Main.hs
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user