Skip to content

Commit 7587b48

Browse files
authored
Merge pull request #1160 from IntersectMBO/newhoggy/standardise-bech32-hex-output-flag
Standardise bech32 hex output flag
2 parents 886b444 + 5d3ecc7 commit 7587b48

File tree

4 files changed

+38
-5
lines changed

4 files changed

+38
-5
lines changed

cardano-cli/src/Cardano/CLI/EraBased/Common/Option.hs

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,14 +1785,27 @@ pKeyOutputFormat =
17851785

17861786
pPoolIdOutputFormat :: Parser (Vary [FormatBech32, FormatHex])
17871787
pPoolIdOutputFormat =
1788+
asum
1789+
[ pFormatFlags
1790+
"pool-id output"
1791+
[ flagFormatBech32 & setDefault
1792+
, flagFormatHex
1793+
]
1794+
, pDeprecatedPoolIdOutputFormat
1795+
]
1796+
1797+
pDeprecatedPoolIdOutputFormat :: Parser (Vary [FormatBech32, FormatHex])
1798+
pDeprecatedPoolIdOutputFormat =
17881799
Opt.option readIdOutputFormat $
17891800
mconcat
17901801
[ Opt.long "output-format"
17911802
, Opt.metavar "STRING"
1803+
, Opt.hidden
17921804
, Opt.help $
17931805
mconcat
17941806
[ "Optional pool id output format. Accepted output formats are \"hex\" "
1795-
, "and \"bech32\" (default is \"bech32\")."
1807+
, "and \"bech32\" (default is \"bech32\"). The --output-format flag is "
1808+
, "deprecated and will be removed in a future version."
17961809
]
17971810
, Opt.value (Vary.from FormatBech32)
17981811
]
@@ -1848,12 +1861,24 @@ flagKeyOutputTextEnvelope
18481861
flagKeyOutputTextEnvelope =
18491862
mkFlag "key-output-text-envelope" "TEXT_ENVELOPE" FormatTextEnvelope
18501863

1864+
flagFormatBech32
1865+
:: FormatBech32 :| fs
1866+
=> Flag (Vary fs)
1867+
flagFormatBech32 =
1868+
mkFlag "output-bech32" "BECH32" FormatBech32
1869+
18511870
flagFormatCbor
18521871
:: FormatCbor :| fs
18531872
=> Flag (Vary fs)
18541873
flagFormatCbor =
18551874
mkFlag "output-cbor" "BASE16 CBOR" FormatCbor
18561875

1876+
flagFormatHex
1877+
:: FormatHex :| fs
1878+
=> Flag (Vary fs)
1879+
flagFormatHex =
1880+
mkFlag "output-hex" "HEX" FormatHex
1881+
18571882
flagFormatJson
18581883
:: FormatJson :| fs
18591884
=> Flag (Vary fs)

cardano-cli/test/cardano-cli-golden/files/golden/help.cli

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,7 @@ Usage: cardano-cli conway stake-pool id
26002600
| --stake-pool-verification-extended-key STRING
26012601
| --cold-verification-key-file FILEPATH
26022602
)
2603-
[--output-format STRING]
2603+
[--output-bech32 | --output-hex]
26042604
[--out-file FILEPATH]
26052605

26062606
Build pool id from the offline key
@@ -4833,7 +4833,7 @@ Usage: cardano-cli latest stake-pool id
48334833
| --stake-pool-verification-extended-key STRING
48344834
| --cold-verification-key-file FILEPATH
48354835
)
4836-
[--output-format STRING]
4836+
[--output-bech32 | --output-hex]
48374837
[--out-file FILEPATH]
48384838

48394839
Build pool id from the offline key

cardano-cli/test/cardano-cli-golden/files/golden/help/conway_stake-pool_id.cli

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Usage: cardano-cli conway stake-pool id
33
| --stake-pool-verification-extended-key STRING
44
| --cold-verification-key-file FILEPATH
55
)
6-
[--output-format STRING]
6+
[--output-bech32 | --output-hex]
77
[--out-file FILEPATH]
88

99
Build pool id from the offline key
@@ -16,7 +16,11 @@ Available options:
1616
hex-encoded).
1717
--cold-verification-key-file FILEPATH
1818
Filepath of the stake pool verification key.
19+
--output-bech32 Format pool-id output to BECH32 (default).
20+
--output-hex Format pool-id output to HEX.
1921
--output-format STRING Optional pool id output format. Accepted output
2022
formats are "hex" and "bech32" (default is "bech32").
23+
The --output-format flag is deprecated and will be
24+
removed in a future version.
2125
--out-file FILEPATH Optional output file. Default is to write to stdout.
2226
-h,--help Show this help text

cardano-cli/test/cardano-cli-golden/files/golden/help/latest_stake-pool_id.cli

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Usage: cardano-cli latest stake-pool id
33
| --stake-pool-verification-extended-key STRING
44
| --cold-verification-key-file FILEPATH
55
)
6-
[--output-format STRING]
6+
[--output-bech32 | --output-hex]
77
[--out-file FILEPATH]
88

99
Build pool id from the offline key
@@ -16,7 +16,11 @@ Available options:
1616
hex-encoded).
1717
--cold-verification-key-file FILEPATH
1818
Filepath of the stake pool verification key.
19+
--output-bech32 Format pool-id output to BECH32 (default).
20+
--output-hex Format pool-id output to HEX.
1921
--output-format STRING Optional pool id output format. Accepted output
2022
formats are "hex" and "bech32" (default is "bech32").
23+
The --output-format flag is deprecated and will be
24+
removed in a future version.
2125
--out-file FILEPATH Optional output file. Default is to write to stdout.
2226
-h,--help Show this help text

0 commit comments

Comments
 (0)