Move the CLI parser definitions into the lib

So they can be used by library clients to parse and pass in the
appropriate ghc-mod Options.
This commit is contained in:
Alan Zimmerman 2016-02-08 22:34:20 +02:00
parent d77e262915
commit 1cc97db24f
8 changed files with 22 additions and 21 deletions

View File

@ -16,15 +16,15 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
module GHCMod.Options.Commands where
module Language.Haskell.GhcMod.Options.Commands where
import Options.Applicative
import Options.Applicative.Types
import Options.Applicative.Builder.Internal
import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.Read
import GHCMod.Options.DocUtils
import GHCMod.Options.Help
import Language.Haskell.GhcMod.Options.DocUtils
import Language.Haskell.GhcMod.Options.Help
type Symbol = String
type Expr = String

View File

@ -14,7 +14,7 @@
-- You should have received a copy of the GNU Affero General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module GHCMod.Options.DocUtils (
module Language.Haskell.GhcMod.Options.DocUtils (
($$),
($$$),
(<=>),

View File

@ -15,7 +15,7 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
{-# LANGUAGE OverloadedStrings, FlexibleInstances, GeneralizedNewtypeDeriving #-}
module GHCMod.Options.Help where
module Language.Haskell.GhcMod.Options.Help where
import Options.Applicative
import Options.Applicative.Help.Pretty (Doc)

View File

@ -16,7 +16,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
module GHCMod.Options (
module Language.Haskell.GhcMod.Options.Options (
parseArgs,
parseArgsInteractive,
GhcModCommands(..)
@ -29,11 +29,11 @@ import Control.Arrow
import Data.Char (toUpper, toLower)
import Data.List (intercalate)
import Language.Haskell.GhcMod.Read
import GHCMod.Options.Commands
import GHCMod.Version
import GHCMod.Options.DocUtils
import GHCMod.Options.Help
import GHCMod.Options.ShellParse
import Language.Haskell.GhcMod.Options.Commands
import Language.Haskell.GhcMod.Options.Version
import Language.Haskell.GhcMod.Options.DocUtils
import Language.Haskell.GhcMod.Options.Help
import Language.Haskell.GhcMod.Options.ShellParse
parseArgs :: IO (Options, GhcModCommands)
parseArgs =

View File

@ -13,7 +13,7 @@
--
-- You should have received a copy of the GNU Affero General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module GHCMod.Options.ShellParse (parseCmdLine) where
module Language.Haskell.GhcMod.Options.ShellParse (parseCmdLine) where
import Data.Char
import Data.List

View File

@ -14,7 +14,7 @@
-- You should have received a copy of the GNU Affero General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module GHCMod.Version where
module Language.Haskell.GhcMod.Options.Version where
import Paths_ghc_mod
import Data.Version (showVersion)

View File

@ -152,6 +152,13 @@ Library
Language.Haskell.GhcMod.Types
Language.Haskell.GhcMod.Utils
Language.Haskell.GhcMod.World
Language.Haskell.GhcMod.Options.Options
Language.Haskell.GhcMod.Options.Commands
Language.Haskell.GhcMod.Options.Version
Language.Haskell.GhcMod.Options.DocUtils
Language.Haskell.GhcMod.Options.ShellParse
Language.Haskell.GhcMod.Options.Help
Other-Modules: Paths_ghc_mod
Utils
Data.Binary.Generic
@ -187,6 +194,7 @@ Library
, extra == 1.4.*
, pipes == 4.1.*
, safe < 0.4 && >= 0.3.9
, optparse-applicative >=0.11.0 && <0.13.0
if impl(ghc < 7.8)
Build-Depends: convertible
if impl(ghc < 7.5)
@ -198,12 +206,6 @@ Executable ghc-mod
Default-Language: Haskell2010
Main-Is: GHCMod.hs
Other-Modules: Paths_ghc_mod
, GHCMod.Options
, GHCMod.Options.Commands
, GHCMod.Version
, GHCMod.Options.DocUtils
, GHCMod.Options.ShellParse
, GHCMod.Options.Help
GHC-Options: -Wall -fno-warn-deprecations -threaded
Default-Extensions: ConstraintKinds, FlexibleContexts
HS-Source-Dirs: src
@ -217,7 +219,6 @@ Executable ghc-mod
, ghc < 7.11
, monad-control ==1.0.*
, fclabels ==2.0.*
, optparse-applicative >=0.11.0 && <0.13.0
, ghc-mod
Executable ghc-modi

View File

@ -19,7 +19,7 @@ import System.Directory (setCurrentDirectory, getAppUserDataDirectory,
import System.IO
import System.Exit
import Text.PrettyPrint hiding ((<>))
import GHCMod.Options
import Language.Haskell.GhcMod.Options.Options
import Prelude
ghcModStyle :: Style