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:
parent
d77e262915
commit
1cc97db24f
@ -16,15 +16,15 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
|
{-# 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
|
||||||
import Options.Applicative.Types
|
import Options.Applicative.Types
|
||||||
import Options.Applicative.Builder.Internal
|
import Options.Applicative.Builder.Internal
|
||||||
import Language.Haskell.GhcMod.Types
|
import Language.Haskell.GhcMod.Types
|
||||||
import Language.Haskell.GhcMod.Read
|
import Language.Haskell.GhcMod.Read
|
||||||
import GHCMod.Options.DocUtils
|
import Language.Haskell.GhcMod.Options.DocUtils
|
||||||
import GHCMod.Options.Help
|
import Language.Haskell.GhcMod.Options.Help
|
||||||
|
|
||||||
type Symbol = String
|
type Symbol = String
|
||||||
type Expr = String
|
type Expr = String
|
@ -14,7 +14,7 @@
|
|||||||
-- You should have received a copy of the GNU Affero General Public License
|
-- 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/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
module GHCMod.Options.DocUtils (
|
module Language.Haskell.GhcMod.Options.DocUtils (
|
||||||
($$),
|
($$),
|
||||||
($$$),
|
($$$),
|
||||||
(<=>),
|
(<=>),
|
@ -15,7 +15,7 @@
|
|||||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
{-# LANGUAGE OverloadedStrings, FlexibleInstances, GeneralizedNewtypeDeriving #-}
|
{-# LANGUAGE OverloadedStrings, FlexibleInstances, GeneralizedNewtypeDeriving #-}
|
||||||
|
|
||||||
module GHCMod.Options.Help where
|
module Language.Haskell.GhcMod.Options.Help where
|
||||||
|
|
||||||
import Options.Applicative
|
import Options.Applicative
|
||||||
import Options.Applicative.Help.Pretty (Doc)
|
import Options.Applicative.Help.Pretty (Doc)
|
@ -16,7 +16,7 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
|
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
|
||||||
|
|
||||||
module GHCMod.Options (
|
module Language.Haskell.GhcMod.Options.Options (
|
||||||
parseArgs,
|
parseArgs,
|
||||||
parseArgsInteractive,
|
parseArgsInteractive,
|
||||||
GhcModCommands(..)
|
GhcModCommands(..)
|
||||||
@ -29,11 +29,11 @@ import Control.Arrow
|
|||||||
import Data.Char (toUpper, toLower)
|
import Data.Char (toUpper, toLower)
|
||||||
import Data.List (intercalate)
|
import Data.List (intercalate)
|
||||||
import Language.Haskell.GhcMod.Read
|
import Language.Haskell.GhcMod.Read
|
||||||
import GHCMod.Options.Commands
|
import Language.Haskell.GhcMod.Options.Commands
|
||||||
import GHCMod.Version
|
import Language.Haskell.GhcMod.Options.Version
|
||||||
import GHCMod.Options.DocUtils
|
import Language.Haskell.GhcMod.Options.DocUtils
|
||||||
import GHCMod.Options.Help
|
import Language.Haskell.GhcMod.Options.Help
|
||||||
import GHCMod.Options.ShellParse
|
import Language.Haskell.GhcMod.Options.ShellParse
|
||||||
|
|
||||||
parseArgs :: IO (Options, GhcModCommands)
|
parseArgs :: IO (Options, GhcModCommands)
|
||||||
parseArgs =
|
parseArgs =
|
@ -13,7 +13,7 @@
|
|||||||
--
|
--
|
||||||
-- You should have received a copy of the GNU Affero General Public License
|
-- 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/>.
|
-- 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.Char
|
||||||
import Data.List
|
import Data.List
|
@ -14,7 +14,7 @@
|
|||||||
-- You should have received a copy of the GNU Affero General Public License
|
-- 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/>.
|
-- 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 Paths_ghc_mod
|
||||||
import Data.Version (showVersion)
|
import Data.Version (showVersion)
|
@ -152,6 +152,13 @@ Library
|
|||||||
Language.Haskell.GhcMod.Types
|
Language.Haskell.GhcMod.Types
|
||||||
Language.Haskell.GhcMod.Utils
|
Language.Haskell.GhcMod.Utils
|
||||||
Language.Haskell.GhcMod.World
|
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
|
Other-Modules: Paths_ghc_mod
|
||||||
Utils
|
Utils
|
||||||
Data.Binary.Generic
|
Data.Binary.Generic
|
||||||
@ -187,6 +194,7 @@ Library
|
|||||||
, extra == 1.4.*
|
, extra == 1.4.*
|
||||||
, pipes == 4.1.*
|
, pipes == 4.1.*
|
||||||
, safe < 0.4 && >= 0.3.9
|
, safe < 0.4 && >= 0.3.9
|
||||||
|
, optparse-applicative >=0.11.0 && <0.13.0
|
||||||
if impl(ghc < 7.8)
|
if impl(ghc < 7.8)
|
||||||
Build-Depends: convertible
|
Build-Depends: convertible
|
||||||
if impl(ghc < 7.5)
|
if impl(ghc < 7.5)
|
||||||
@ -198,12 +206,6 @@ Executable ghc-mod
|
|||||||
Default-Language: Haskell2010
|
Default-Language: Haskell2010
|
||||||
Main-Is: GHCMod.hs
|
Main-Is: GHCMod.hs
|
||||||
Other-Modules: Paths_ghc_mod
|
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
|
GHC-Options: -Wall -fno-warn-deprecations -threaded
|
||||||
Default-Extensions: ConstraintKinds, FlexibleContexts
|
Default-Extensions: ConstraintKinds, FlexibleContexts
|
||||||
HS-Source-Dirs: src
|
HS-Source-Dirs: src
|
||||||
@ -217,7 +219,6 @@ Executable ghc-mod
|
|||||||
, ghc < 7.11
|
, ghc < 7.11
|
||||||
, monad-control ==1.0.*
|
, monad-control ==1.0.*
|
||||||
, fclabels ==2.0.*
|
, fclabels ==2.0.*
|
||||||
, optparse-applicative >=0.11.0 && <0.13.0
|
|
||||||
, ghc-mod
|
, ghc-mod
|
||||||
|
|
||||||
Executable ghc-modi
|
Executable ghc-modi
|
||||||
|
@ -19,7 +19,7 @@ import System.Directory (setCurrentDirectory, getAppUserDataDirectory,
|
|||||||
import System.IO
|
import System.IO
|
||||||
import System.Exit
|
import System.Exit
|
||||||
import Text.PrettyPrint hiding ((<>))
|
import Text.PrettyPrint hiding ((<>))
|
||||||
import GHCMod.Options
|
import Language.Haskell.GhcMod.Options.Options
|
||||||
import Prelude
|
import Prelude
|
||||||
|
|
||||||
ghcModStyle :: Style
|
ghcModStyle :: Style
|
||||||
|
Loading…
Reference in New Issue
Block a user