diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@
 `gen-hie` should be run the root of a cabal or stack project.
 The config type (cabal or stack) is determined by the existence of
 `dist-newstyle`, `.stack-work`, `stack.yaml`, if none are found the default is cabal.
+You can use `--cabal`, or `--stack` options to override config type.
 
 # Cabal Multi project example
 ```bash
diff --git a/app/Main.hs b/app/Main.hs
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -9,7 +9,9 @@
 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 @@
     "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 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
diff --git a/implicit-hie.cabal b/implicit-hie.cabal
--- a/implicit-hie.cabal
+++ b/implicit-hie.cabal
@@ -7,7 +7,7 @@
 -- hash: b2b829a658e33ea328c725dea732391089d03ffd2a216d413a75d88aefa7c181
 
 name:               implicit-hie
-version:            0.1.2.6
+version:            0.1.2.7
 description:
   Auto generate a stack or cabal multi component hie.yaml file
 
@@ -61,6 +61,10 @@
 
   default-language: Haskell2010
 
+flag executable
+  description: Build the gen-hie executable
+  default: True
+
 executable gen-hie
   main-is:          Main.hs
   other-modules:    Paths_implicit_hie
@@ -84,6 +88,9 @@
     , yaml
 
   default-language: Haskell2010
+  
+  if !flag(executable)
+    buildable: False
 
 test-suite implicit-hie-test
   type:             exitcode-stdio-1.0
diff --git a/src/Hie/Cabal/Parser.hs b/src/Hie/Cabal/Parser.hs
--- a/src/Hie/Cabal/Parser.hs
+++ b/src/Hie/Cabal/Parser.hs
@@ -87,7 +87,9 @@
     <|> parseTestSuite i
 
 parseLib :: Indent -> Parser [Component]
-parseLib i = parseSec i "library" $ Comp Lib
+parseLib i =
+  (parseSec i "library" $ Comp Lib)
+    <|> (parseSec i "foreign-library" $ Comp Lib)
 
 parseTestSuite :: Indent -> Parser [Component]
 parseTestSuite i = parseSec i "test-suite" $ Comp Test
