Skip to content

Commit 6a4b0fc

Browse files
committed
Move the command line arguments to the main
1 parent 9b1d810 commit 6a4b0fc

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/CmdLine.hs

+2-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import Data.List
66
import Data.Maybe
77
import System.Console.GetOpt
88
import System.Directory
9-
import System.Environment
109
import System.Exit
1110
import System.FilePath
1211
import Language.Preprocessor.Cpphs
@@ -57,9 +56,8 @@ opts = [Option "?" ["help"] (NoArg Help) "Display help message"
5756

5857

5958
-- | Exit out if you need to display help info
60-
getCmd :: IO Cmd
61-
getCmd = do
62-
args <- getArgs
59+
getCmd :: [String] -> IO Cmd
60+
getCmd args = do
6361
let (opt,files,err) = getOpt Permute opts args
6462
let test = Test `elem` opt
6563
unless (null err) $

src/HLint.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ import Hint.All
2020
import HSE.All
2121

2222

23-
main = do
24-
Cmd{..} <- getCmd
23+
main :: [String] -> IO ()
24+
main args = do
25+
Cmd{..} <- getCmd args
2526
if cmdTest then test cmdDataDir else do
2627
settings <- readSettings cmdDataDir cmdHintFiles
2728
let extra = [Classify Ignore x ("","") | x <- cmdIgnore]

src/Main.hs

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1919
module Main where
2020

2121
import qualified HLint
22+
import System.Environment
2223

2324
main :: IO ()
24-
main = HLint.main
25+
main = do
26+
args <- getArgs
27+
HLint.main args
28+

0 commit comments

Comments
 (0)