@@ -17,7 +17,8 @@ import Control.Monad.Extra ( concatMapM
17
17
, when
18
18
)
19
19
import Data.Hashable ( hash )
20
- import Data.List ( isSuffixOf
20
+ import Data.List ( intercalate
21
+ , isSuffixOf
21
22
, find
22
23
, nub
23
24
)
@@ -35,6 +36,7 @@ import Development.Shake.FilePath ( (</>)
35
36
import Options.Applicative ( Parser
36
37
, (<**>)
37
38
, (<|>)
39
+ , auto
38
40
, command
39
41
, execParser
40
42
, fullDesc
@@ -45,6 +47,7 @@ import Options.Applicative ( Parser
45
47
, long
46
48
, many
47
49
, metavar
50
+ , option
48
51
, optional
49
52
, progDesc
50
53
, short
@@ -90,15 +93,15 @@ data Arguments =
90
93
, runFlags :: [String ]
91
94
, runRunner :: Maybe String
92
95
, runTarget :: Maybe String
93
- , runArgs :: Maybe String
96
+ , runArgs :: Maybe [ String ]
94
97
}
95
98
| Test
96
99
{ testRelease :: Bool
97
100
, testCompiler :: FilePath
98
101
, testFlags :: [String ]
99
102
, testRunner :: Maybe String
100
103
, testTarget :: Maybe String
101
- , testArgs :: Maybe String
104
+ , testArgs :: Maybe [ String ]
102
105
}
103
106
104
107
data TomlSettings = TomlSettings {
@@ -183,7 +186,7 @@ app args settings = case args of
183
186
Just r -> r ++ " "
184
187
commandSufix = case runArgs of
185
188
Nothing -> " "
186
- Just a -> " " ++ a
189
+ Just a -> " " ++ (intercalate " " a)
187
190
in case whichOne of
188
191
Nothing -> do
189
192
exitCodes <- mapM
@@ -228,7 +231,7 @@ app args settings = case args of
228
231
Just r -> r ++ " "
229
232
commandSufix = case testArgs of
230
233
Nothing -> " "
231
- Just a -> " " ++ a
234
+ Just a -> " " ++ (intercalate " " a)
232
235
in case whichOne of
233
236
Nothing -> do
234
237
exitCodes <- mapM
@@ -433,11 +436,19 @@ runArguments =
433
436
)
434
437
)
435
438
<*> optional
436
- (strArgument
437
- (metavar " TARGET" <> help " Name of the executable to run" )
439
+ (strOption
440
+ (long " target" <> metavar " TARGET" <> help
441
+ " Name of the executable to run"
442
+ )
438
443
)
439
444
<*> optional
440
- (strArgument (metavar " ARGS" <> help " Arguments to the executable" ))
445
+ (many
446
+ (strArgument
447
+ ( metavar " ARGS"
448
+ <> help " Arguments to the executable(s) (should follow '--')"
449
+ )
450
+ )
451
+ )
441
452
442
453
testArguments :: Parser Arguments
443
454
testArguments =
@@ -468,8 +479,18 @@ testArguments =
468
479
)
469
480
)
470
481
<*> optional
471
- (strArgument (metavar " TARGET" <> help " Name of the test to run" ))
472
- <*> optional (strArgument (metavar " ARGS" <> help " Arguments to the test" ))
482
+ (strOption
483
+ (long " target" <> metavar " TARGET" <> help " Name of the test to run"
484
+ )
485
+ )
486
+ <*> optional
487
+ (many
488
+ (strArgument
489
+ ( metavar " ARGS"
490
+ <> help " Arguments to the test(s) (should follow '--')"
491
+ )
492
+ )
493
+ )
473
494
474
495
getDirectoriesFiles :: [FilePath ] -> [FilePattern ] -> IO [FilePath ]
475
496
getDirectoriesFiles dirs exts = getDirectoryFilesIO " " newPatterns
0 commit comments