File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ import Hie.Locate
9
9
import Hie.Yaml
10
10
import System.Directory
11
11
import System.Environment
12
+ import System.Exit
12
13
import System.FilePath.Posix
14
+ import System.IO
13
15
14
16
main :: IO ()
15
17
main = do
@@ -19,7 +21,7 @@ main = do
19
21
" cabal" -> cabalPkgs pwd
20
22
_ -> stackYamlPkgs pwd
21
23
when (null cfs) $
22
- error $
24
+ die $
23
25
" Used" <> name
24
26
<> " \n No .cabal files found under"
25
27
<> pwd
@@ -31,6 +33,12 @@ resolveName :: FilePath -> IO String
31
33
resolveName pwd = do
32
34
args <- getArgs
33
35
files <- listDirectory pwd
36
+ when (" --help" `elem` args || " -h" `elem` args) $ do
37
+ progName <- getProgName
38
+ hPutStrLn stderr $ " Usage: " <> progName <> " [ --cabal | --stack ]\n\n \
39
+ \If neither argument is given then " <> progName <> " will infer the type by\n \
40
+ \looking for dist-newstyle, .stack-work, cabal.project and stack.yaml in that order."
41
+ exitSuccess
34
42
let fileNames = map takeFileName files
35
43
name =
36
44
if
You can’t perform that action at this time.
0 commit comments