@@ -30,6 +30,7 @@ import Data.Function
30
30
import GHC.Exts (IsList (.. ))
31
31
import Options.Applicative hiding (help , str )
32
32
import Options.Applicative qualified as Opt
33
+ import Vary (Vary )
33
34
34
35
pQueryCmdsTopLevel :: EnvCli -> Parser (QueryCmds ConwayEra )
35
36
pQueryCmdsTopLevel envCli =
@@ -355,8 +356,8 @@ pQueryProtocolParametersCmd envCli =
355
356
<*> pNetworkId envCli
356
357
<*> pSocketPath envCli
357
358
)
358
- <*> pFormatFlags
359
- " protocol-parameters query output "
359
+ <*> pFormatQueryOutputFlags
360
+ " protocol-parameters"
360
361
[ flagFormatJson & setDefault
361
362
, flagFormatYaml
362
363
]
@@ -367,8 +368,8 @@ pQueryTipCmd era envCli =
367
368
fmap QueryTipCmd $
368
369
QueryTipCmdArgs
369
370
<$> pQueryCommons era envCli
370
- <*> pFormatFlags
371
- " tip query output "
371
+ <*> pFormatQueryOutputFlags
372
+ " tip"
372
373
[ flagFormatJson & setDefault
373
374
, flagFormatYaml
374
375
]
@@ -380,8 +381,8 @@ pQueryUTxOCmd era envCli =
380
381
QueryUTxOCmdArgs
381
382
<$> pQueryCommons era envCli
382
383
<*> pQueryUTxOFilter
383
- <*> pFormatFlags
384
- " utxo query output "
384
+ <*> pFormatQueryOutputFlags
385
+ " utxo"
385
386
[ flagFormatCborBin
386
387
, flagFormatCborHex
387
388
, flagFormatJson & setDefault
@@ -394,8 +395,8 @@ pQueryStakePoolsCmd era envCli =
394
395
fmap QueryStakePoolsCmd $
395
396
QueryStakePoolsCmdArgs
396
397
<$> pQueryCommons era envCli
397
- <*> pFormatFlags
398
- " stake-pools query output "
398
+ <*> pFormatQueryOutputFlags
399
+ " stake-pools"
399
400
[ flagFormatJson & setDefault
400
401
, flagFormatText
401
402
]
@@ -406,8 +407,8 @@ pQueryStakeDistributionCmd era envCli =
406
407
fmap QueryStakeDistributionCmd $
407
408
QueryStakeDistributionCmdArgs
408
409
<$> pQueryCommons era envCli
409
- <*> pFormatFlags
410
- " stake-distribution query output "
410
+ <*> pFormatQueryOutputFlags
411
+ " stake-distribution"
411
412
[ flagFormatJson & setDefault
412
413
, flagFormatText
413
414
]
@@ -419,8 +420,8 @@ pQueryStakeAddressInfoCmd era envCli =
419
420
QueryStakeAddressInfoCmdArgs
420
421
<$> pQueryCommons era envCli
421
422
<*> pFilterByStakeAddress
422
- <*> pFormatFlags
423
- " stake-address-info query output "
423
+ <*> pFormatQueryOutputFlags
424
+ " stake-address-info"
424
425
[ flagFormatJson & setDefault
425
426
, flagFormatYaml
426
427
]
@@ -431,8 +432,8 @@ pQueryLedgerStateCmd era envCli =
431
432
fmap QueryLedgerStateCmd $
432
433
QueryLedgerStateCmdArgs
433
434
<$> pQueryCommons era envCli
434
- <*> pFormatFlags
435
- " ledger-state query output "
435
+ <*> pFormatQueryOutputFlags
436
+ " ledger-state"
436
437
[ flagFormatJson & setDefault
437
438
, flagFormatText
438
439
]
@@ -443,8 +444,8 @@ pQueryLedgerPeerSnapshotCmd era envCli =
443
444
fmap QueryLedgerPeerSnapshotCmd $
444
445
QueryLedgerPeerSnapshotCmdArgs
445
446
<$> pQueryCommons era envCli
446
- <*> pFormatFlags
447
- " ledger-peer-snapshot query output "
447
+ <*> pFormatQueryOutputFlags
448
+ " ledger-peer-snapshot"
448
449
[ flagFormatJson & setDefault
449
450
, flagFormatYaml
450
451
]
@@ -455,8 +456,8 @@ pQueryProtocolStateCmd era envCli =
455
456
fmap QueryProtocolStateCmd $
456
457
QueryProtocolStateCmdArgs
457
458
<$> pQueryCommons era envCli
458
- <*> pFormatFlags
459
- " protocol-state query output "
459
+ <*> pFormatQueryOutputFlags
460
+ " protocol-state"
460
461
[ flagFormatCborBin
461
462
, flagFormatCborHex
462
463
, flagFormatJson & setDefault
@@ -483,8 +484,8 @@ pQueryStakeSnapshotCmd era envCli =
483
484
QueryStakeSnapshotCmdArgs
484
485
<$> pQueryCommons era envCli
485
486
<*> pAllStakePoolsOrSome
486
- <*> pFormatFlags
487
- " stake-snapshot query output "
487
+ <*> pFormatQueryOutputFlags
488
+ " stake-snapshot"
488
489
[ flagFormatJson & setDefault
489
490
, flagFormatYaml
490
491
]
@@ -496,8 +497,8 @@ pQueryPoolStateCmd era envCli =
496
497
QueryPoolStateCmdArgs
497
498
<$> pQueryCommons era envCli
498
499
<*> pAllStakePoolsOrSome
499
- <*> pFormatFlags
500
- " pool-state query output "
500
+ <*> pFormatQueryOutputFlags
501
+ " pool-state"
501
502
[ flagFormatJson & setDefault
502
503
, flagFormatYaml
503
504
]
@@ -513,8 +514,8 @@ pQueryTxMempoolCmd envCli =
513
514
<*> pSocketPath envCli
514
515
)
515
516
<*> pTxMempoolQuery
516
- <*> pFormatFlags
517
- " tx-mempool query output "
517
+ <*> pFormatQueryOutputFlags
518
+ " tx-mempool"
518
519
[ flagFormatJson & setDefault
519
520
, flagFormatYaml
520
521
]
@@ -546,8 +547,8 @@ pLeadershipScheduleCmd era envCli =
546
547
<*> pStakePoolVerificationKeyOrHashOrFile Nothing
547
548
<*> pVrfSigningKeyFile
548
549
<*> pWhichLeadershipSchedule
549
- <*> pFormatFlags
550
- " leadership-schedule query output "
550
+ <*> pFormatQueryOutputFlags
551
+ " leadership-schedule"
551
552
[ flagFormatJson & setDefault
552
553
, flagFormatText
553
554
, flagFormatYaml
@@ -560,8 +561,8 @@ pKesPeriodInfoCmd era envCli =
560
561
QueryKesPeriodInfoCmdArgs
561
562
<$> pQueryCommons era envCli
562
563
<*> pOperationalCertificateFile
563
- <*> pFormatFlags
564
- " kes-period-info query output "
564
+ <*> pFormatQueryOutputFlags
565
+ " kes-period-info"
565
566
[ flagFormatJson & setDefault
566
567
, flagFormatYaml
567
568
]
@@ -587,8 +588,8 @@ pQueryRefScriptSizeCmd era envCli =
587
588
QueryRefScriptSizeCmdArgs
588
589
<$> pQueryCommons era envCli
589
590
<*> (fromList <$> some pByTxIn)
590
- <*> pFormatFlags
591
- " reference inputs query output "
591
+ <*> pFormatQueryOutputFlags
592
+ " reference-script-size "
592
593
[ flagFormatJson & setDefault
593
594
, flagFormatText
594
595
]
@@ -692,8 +693,8 @@ pQueryDRepStateCmd era envCli = do
692
693
]
693
694
]
694
695
)
695
- <*> pFormatFlags
696
- " drep-state query output "
696
+ <*> pFormatQueryOutputFlags
697
+ " drep-state"
697
698
[ flagFormatJson & setDefault
698
699
, flagFormatYaml
699
700
]
@@ -718,8 +719,8 @@ pQueryDRepStakeDistributionCmd era envCli = do
718
719
QueryDRepStakeDistributionCmdArgs w
719
720
<$> pQueryCommons era envCli
720
721
<*> pAllOrOnlyDRepHashSource
721
- <*> pFormatFlags
722
- " drep-stake-distribution query output "
722
+ <*> pFormatQueryOutputFlags
723
+ " drep-stake-distribution"
723
724
[ flagFormatJson & setDefault
724
725
, flagFormatYaml
725
726
]
@@ -747,8 +748,8 @@ pQueryProposalsCmd era envCli = do
747
748
QueryProposalsCmdArgs w
748
749
<$> pQueryCommons (convert w) envCli
749
750
<*> pAllOrOnlyGovActionIds
750
- <*> pFormatFlags
751
- " proposals query output "
751
+ <*> pFormatQueryOutputFlags
752
+ " proposals"
752
753
[ flagFormatJson & setDefault
753
754
, flagFormatYaml
754
755
]
@@ -773,8 +774,8 @@ pQuerySPOStakeDistributionCmd era envCli = do
773
774
QuerySPOStakeDistributionCmdArgs w
774
775
<$> pQueryCommons era envCli
775
776
<*> pAllOrOnlySPOHashSource
776
- <*> pFormatFlags
777
- " spo-stake-distribution query output "
777
+ <*> pFormatQueryOutputFlags
778
+ " spo-stake-distribution"
778
779
[ flagFormatJson & setDefault
779
780
, flagFormatYaml
780
781
]
@@ -801,8 +802,8 @@ pQueryGetCommitteeStateCmd era envCli = do
801
802
<*> many pCommitteeColdVerificationKeyOrHashOrFileOrScriptHash
802
803
<*> many pCommitteeHotKeyOrHashOrFileOrScriptHash
803
804
<*> many pMemberStatus
804
- <*> pFormatFlags
805
- " committee-state query output "
805
+ <*> pFormatQueryOutputFlags
806
+ " committee-state"
806
807
[ flagFormatJson & setDefault
807
808
, flagFormatYaml
808
809
]
@@ -889,8 +890,8 @@ pQueryStakePoolDefaultVote era envCli = do
889
890
QueryStakePoolDefaultVoteCmdArgs w
890
891
<$> pQueryCommons era envCli
891
892
<*> pSPOHashSource
892
- <*> pFormatFlags
893
- " stake-pool-default-vote query output "
893
+ <*> pFormatQueryOutputFlags
894
+ " stake-pool-default-vote"
894
895
[ flagFormatJson & setDefault
895
896
, flagFormatYaml
896
897
]
@@ -906,8 +907,8 @@ pQueryNoArgCmdArgs
906
907
pQueryNoArgCmdArgs w envCli name =
907
908
QueryNoArgCmdArgs w
908
909
<$> pQueryCommons (convert w) envCli
909
- <*> pFormatFlags
910
- ( name <> " query output " )
910
+ <*> pFormatQueryOutputFlags
911
+ name
911
912
[ flagFormatJson & setDefault
912
913
, flagFormatYaml
913
914
]
@@ -951,3 +952,10 @@ pQueryEraHistoryCmd envCli =
951
952
QueryEraHistoryCmdArgs
952
953
<$> pQueryCommons ShelleyBasedEraConway envCli
953
954
<*> pMaybeOutputFile
955
+
956
+ pFormatQueryOutputFlags
957
+ :: String
958
+ -> [Flag (Vary fs )]
959
+ -> Parser (Vary fs )
960
+ pFormatQueryOutputFlags content =
961
+ pFormatFlags $ content <> " query output"
0 commit comments