-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #934 from IntersectMBO/jordan/move-address-command…
…s-to-top-level Move address commands to top level
- Loading branch information
Showing
18 changed files
with
248 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE FlexibleContexts #-} | ||
{-# LANGUAGE GADTs #-} | ||
{-# LANGUAGE ScopedTypeVariables #-} | ||
|
||
module Cardano.CLI.Options.Address | ||
( pAddressCmds | ||
) | ||
where | ||
|
||
import Cardano.CLI.Commands.Address | ||
import Cardano.CLI.Environment (EnvCli (..)) | ||
import Cardano.CLI.EraBased.Options.Common | ||
|
||
import Data.Foldable | ||
import Options.Applicative hiding (help, str) | ||
import qualified Options.Applicative as Opt | ||
|
||
pAddressCmds | ||
:: () | ||
=> EnvCli | ||
-> Parser AddressCmds | ||
pAddressCmds envCli = | ||
let addressParsers = | ||
asum | ||
[ subParser "key-gen" $ | ||
Opt.info pAddressKeyGen $ | ||
Opt.progDesc "Create an address key pair." | ||
, subParser "key-hash" $ | ||
Opt.info pAddressKeyHash $ | ||
Opt.progDesc "Print the hash of an address key." | ||
, subParser "build" $ | ||
Opt.info (pAddressBuild envCli) $ | ||
Opt.progDesc "Build a Shelley payment address, with optional delegation to a stake address." | ||
, subParser "info" $ | ||
Opt.info pAddressInfo $ | ||
Opt.progDesc "Print information about an address." | ||
] | ||
in subParser | ||
"address" | ||
$ Opt.info | ||
addressParsers | ||
( Opt.progDesc $ | ||
mconcat | ||
[ "Payment address commands." | ||
] | ||
) | ||
|
||
pAddressKeyGen :: Parser AddressCmds | ||
pAddressKeyGen = | ||
AddressKeyGen | ||
<$> pKeyOutputFormat | ||
<*> pAddressKeyType | ||
<*> pVerificationKeyFileOut | ||
<*> pSigningKeyFileOut | ||
|
||
pAddressKeyHash :: Parser AddressCmds | ||
pAddressKeyHash = | ||
AddressKeyHash | ||
<$> pPaymentVerificationKeyTextOrFile | ||
<*> pMaybeOutputFile | ||
|
||
pAddressBuild :: EnvCli -> Parser AddressCmds | ||
pAddressBuild envCli = | ||
AddressBuild | ||
<$> pPaymentVerifier | ||
<*> Opt.optional (pStakeIdentifier Nothing) | ||
<*> pNetworkId envCli | ||
<*> pMaybeOutputFile | ||
|
||
pAddressInfo :: Parser AddressCmds | ||
pAddressInfo = | ||
AddressInfo | ||
<$> pAddress | ||
<*> pMaybeOutputFile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.