@@ -15,21 +15,15 @@ import Paths_ormolu (version)
15import System.Exit (ExitCode (..), exitWith)
15import System.Exit (ExitCode (..), exitWith)
16import System.IO (hPutStrLn, stderr)
16import System.IO (hPutStrLn, stderr)
17import qualified Data.Text.IO as TIO
17import qualified Data.Text.IO as TIO
18−import qualified Data.Yaml as Yaml
20-- | Entry point of the program.
19-- | Entry point of the program.
22main :: IO ()
21main :: IO ()
23main = withPrettyOrmoluExceptions $ do
22main = withPrettyOrmoluExceptions $ do
24 Opts {..} <- execParser optsParserInfo
23 Opts {..} <- execParser optsParserInfo
25− config <- case optConfigFile of
26− Nothing -> return optConfig
28− config <- Yaml.decodeFileThrow path
29− return (config <> optConfig)
30 r <- case optInputFile of
24 r <- case optInputFile of
31− "-" -> ormoluStdin config
25+ "-" -> ormoluStdin optConfig
32− inputFile -> ormoluFile config inputFile
26+ inputFile -> ormoluFile optConfig inputFile
33 let notForStdin = do
27 let notForStdin = do
34 when (optInputFile == "-") $ do
28 when (optInputFile == "-") $ do
@@ -58,8 +52,6 @@ main = withPrettyOrmoluExceptions $ do
58data Opts = Opts
52data Opts = Opts
59 { optMode :: !Mode
53 { optMode :: !Mode
60 -- ^ Mode of operation
54 -- ^ Mode of operation
61− , optConfigFile :: !(Maybe FilePath)
62− -- ^ Location of configuration file (optional)
63 , optConfig :: !Config
55 , optConfig :: !Config
64 -- ^ Ormolu 'Config'
56 -- ^ Ormolu 'Config'
65 , optInputFile :: !FilePath
57 , optInputFile :: !FilePath
@@ -107,12 +99,6 @@ optsParser = Opts
107 , value Stdout
99 , value Stdout
108 , help "Mode of operation: 'stdout', 'inplace', or 'check'"
100 , help "Mode of operation: 'stdout', 'inplace', or 'check'"
110− <*> (optional . strOption . mconcat)
114− , help "Location of configuration file"
116 <*> configParser
102 <*> configParser
117 <*> (strArgument . mconcat)
103 <*> (strArgument . mconcat)
118 [ metavar "FILE"
104 [ metavar "FILE"