@@ -20,18 +20,20 @@ import Core.Options
20
20
)
21
21
import Core.Types.MPFS (mpfsClientOption )
22
22
import Data.Version (Version )
23
+ import Facts (FactsSelection (.. ), TestRunSelection (.. ))
23
24
import Lib.Box (Box (.. ), fmapBox )
24
25
import MPFS.API (mpfsClient )
25
26
import OptEnvConf
26
27
( Parser
27
28
, command
28
29
, commands
29
- , runParser
30
+ , runParser , (<|>)
30
31
)
31
32
import Oracle.Options (oracleCommandParser )
32
33
import User.Agent.Options (agentCommandParser )
33
34
import User.Requester.Options (requesterCommandParser )
34
35
import Wallet.Options (walletCommandParser )
36
+ import Control.Applicative (optional )
35
37
36
38
newtype Options a = Options
37
39
{ optionsCommand :: Command a
@@ -59,11 +61,37 @@ commandParser =
59
61
" Retract a request"
60
62
retractRequestOptions
61
63
, command " facts" " Get token facts"
62
- $ fmap Box . GetFacts <$> mpfsClientOption <*> tokenIdOption
64
+ $ (\ c tk -> fmapBox (GetFacts c tk))
65
+ <$> mpfsClientOption
66
+ <*> tokenIdOption
67
+ <*> factsSelectionParser
63
68
, command " token" " Get the token content"
64
69
$ fmap Box . GetToken <$> mpfsClientOption <*> tokenIdOption
65
70
]
66
71
72
+ factsSelectionParser :: Parser (Box FactsSelection )
73
+ factsSelectionParser =
74
+ commands
75
+ [ command " user" " Get registered users" (pure $ Box UserFacts )
76
+ , command " role" " Get registered roles" (pure $ Box RoleFacts )
77
+ , command
78
+ " test-run"
79
+ " Get test runs"
80
+ (fmapBox TestRunFacts <$> testRunSelectionParser)
81
+ ] <|> pure (Box AllFacts )
82
+
83
+ testRunSelectionParser :: Parser (Box TestRunSelection )
84
+ testRunSelectionParser =
85
+ commands
86
+ [ command " pending" " Get pending test runs" (pure $ Box TestRunPending )
87
+ , command " running" " Get running test runs" (pure $ Box TestRunRunning )
88
+ , command " done" " Get done test runs" (pure $ Box TestRunDone )
89
+ , command
90
+ " rejected"
91
+ " Get rejected test runs"
92
+ (pure $ Box TestRunRejected )
93
+ ]
94
+
67
95
optionsParser :: Parser (Box Options )
68
96
optionsParser = fmapBox Options <$> commandParser
69
97
0 commit comments