File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
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,8 +21,8 @@ main = do
19
21
" cabal" -> cabalPkgs pwd
20
22
_ -> stackYamlPkgs pwd
21
23
when (null cfs) $
22
- error $
23
- " Used" <> name
24
+ die $
25
+ " Used " <> name
24
26
<> " \n No .cabal files found under"
25
27
<> pwd
26
28
<> " \n You may need to run stack build."
@@ -31,6 +33,16 @@ 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 $
39
+ " Usage: " <> progName
40
+ <> " [ --cabal | --stack ]\n\n \
41
+ \If neither argument is given then "
42
+ <> progName
43
+ <> " will infer the type by\n \
44
+ \looking for dist-newstyle, .stack-work, cabal.project and stack.yaml in that order."
45
+ exitSuccess
34
46
let fileNames = map takeFileName files
35
47
name =
36
48
if
You can’t perform that action at this time.
0 commit comments