Skip to content

Commit bfa4af4

Browse files
committed
[cli] feat: add anti ssh-selectors command
1 parent 71a4b04 commit bfa4af4

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

cli/src/Cli.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import Data.Functor.Identity (Identity (..))
1515
import Facts (FactsSelection, factsCmd)
1616
import GitHub (Auth)
1717
import Lib.JSON.Canonical.Extra
18-
import Lib.SSH.Private (SSHClient, WithSelector (..))
18+
import Lib.SSH.Private (SSHClient, WithSelector (..), sshKeySelectors)
1919
import MPFS.API
2020
( MPFS (..)
2121
, mpfsClient
@@ -70,6 +70,7 @@ data Command a where
7070
-> TokenId
7171
-> Command
7272
(AValidationResult TokenInfoFailure (Token WithValidation))
73+
SSHSelectors :: SSHClient 'WithoutSelector -> Command [String]
7374

7475
data SetupError = TokenNotSpecified
7576
deriving (Show, Eq)
@@ -152,6 +153,7 @@ cmd = \case
152153
$ validateRequest oracle mconfig validation req
153154
pure $ WithValidation r req
154155
lift $ fmapMToken f token
156+
SSHSelectors sshClient -> sshKeySelectors sshClient
155157

156158
newtype TokenInfoFailure = TokenInfoTokenNotParsable TokenId
157159
deriving (Show, Eq)

cli/src/Options.hs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ import User.Agent.Types (TestRunId)
5555
import User.Requester.Options
5656
( requesterCommandParser
5757
, sshClientOption
58+
, sshClientOptionWithoutSelector
5859
)
5960
import Wallet.Options (walletCommandParser)
6061

@@ -106,6 +107,8 @@ commandParser =
106107
<$> githubAuthOption
107108
<*> mpfsClientOption
108109
<*> tokenIdOption
110+
, command "ssh-selectors" "List key selectors for an SSH key file"
111+
$ Box . SSHSelectors <$> sshClientOptionWithoutSelector
109112
]
110113

111114
factsSelectionParser :: Parser (Box FactsSelection)

cli/src/User/Requester/Options.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module User.Requester.Options
55
, addPublicKeyOptions
66
, addRoleOptions
77
, sshClientOption
8+
, sshClientOptionWithoutSelector
89
) where
910

1011
import Core.Options
@@ -130,6 +131,13 @@ sshClientOption =
130131
<*> keyFileOption
131132
<*> keyPasswordOption
132133

134+
sshClientOptionWithoutSelector
135+
:: Parser (SSHClient 'WithoutSelector)
136+
sshClientOptionWithoutSelector =
137+
SSHClient ()
138+
<$> keyFileOption
139+
<*> keyPasswordOption
140+
133141
keySelectorOption :: Parser String
134142
keySelectorOption =
135143
setting

0 commit comments

Comments
 (0)