@@ -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,12 +381,13 @@ 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
388
389
, flagFormatText
390
+ , flagFormatYaml
389
391
]
390
392
<*> pMaybeOutputFile
391
393
@@ -394,10 +396,11 @@ pQueryStakePoolsCmd era envCli =
394
396
fmap QueryStakePoolsCmd $
395
397
QueryStakePoolsCmdArgs
396
398
<$> pQueryCommons era envCli
397
- <*> pFormatFlags
398
- " stake-pools query output "
399
+ <*> pFormatQueryOutputFlags
400
+ " stake-pools"
399
401
[ flagFormatJson & setDefault
400
402
, flagFormatText
403
+ , flagFormatYaml
401
404
]
402
405
<*> pMaybeOutputFile
403
406
@@ -406,10 +409,11 @@ pQueryStakeDistributionCmd era envCli =
406
409
fmap QueryStakeDistributionCmd $
407
410
QueryStakeDistributionCmdArgs
408
411
<$> pQueryCommons era envCli
409
- <*> pFormatFlags
410
- " stake-distribution query output "
412
+ <*> pFormatQueryOutputFlags
413
+ " stake-distribution"
411
414
[ flagFormatJson & setDefault
412
415
, flagFormatText
416
+ , flagFormatYaml
413
417
]
414
418
<*> pMaybeOutputFile
415
419
@@ -419,8 +423,8 @@ pQueryStakeAddressInfoCmd era envCli =
419
423
QueryStakeAddressInfoCmdArgs
420
424
<$> pQueryCommons era envCli
421
425
<*> pFilterByStakeAddress
422
- <*> pFormatFlags
423
- " stake-address-info query output "
426
+ <*> pFormatQueryOutputFlags
427
+ " stake-address-info"
424
428
[ flagFormatJson & setDefault
425
429
, flagFormatYaml
426
430
]
@@ -431,10 +435,11 @@ pQueryLedgerStateCmd era envCli =
431
435
fmap QueryLedgerStateCmd $
432
436
QueryLedgerStateCmdArgs
433
437
<$> pQueryCommons era envCli
434
- <*> pFormatFlags
435
- " ledger-state query output "
438
+ <*> pFormatQueryOutputFlags
439
+ " ledger-state"
436
440
[ flagFormatJson & setDefault
437
441
, flagFormatText
442
+ , flagFormatYaml
438
443
]
439
444
<*> pMaybeOutputFile
440
445
@@ -443,8 +448,8 @@ pQueryLedgerPeerSnapshotCmd era envCli =
443
448
fmap QueryLedgerPeerSnapshotCmd $
444
449
QueryLedgerPeerSnapshotCmdArgs
445
450
<$> pQueryCommons era envCli
446
- <*> pFormatFlags
447
- " ledger-peer-snapshot query output "
451
+ <*> pFormatQueryOutputFlags
452
+ " ledger-peer-snapshot"
448
453
[ flagFormatJson & setDefault
449
454
, flagFormatYaml
450
455
]
@@ -455,8 +460,8 @@ pQueryProtocolStateCmd era envCli =
455
460
fmap QueryProtocolStateCmd $
456
461
QueryProtocolStateCmdArgs
457
462
<$> pQueryCommons era envCli
458
- <*> pFormatFlags
459
- " protocol-state query output "
463
+ <*> pFormatQueryOutputFlags
464
+ " protocol-state"
460
465
[ flagFormatCborBin
461
466
, flagFormatCborHex
462
467
, flagFormatJson & setDefault
@@ -483,8 +488,8 @@ pQueryStakeSnapshotCmd era envCli =
483
488
QueryStakeSnapshotCmdArgs
484
489
<$> pQueryCommons era envCli
485
490
<*> pAllStakePoolsOrSome
486
- <*> pFormatFlags
487
- " stake-snapshot query output "
491
+ <*> pFormatQueryOutputFlags
492
+ " stake-snapshot"
488
493
[ flagFormatJson & setDefault
489
494
, flagFormatYaml
490
495
]
@@ -496,8 +501,8 @@ pQueryPoolStateCmd era envCli =
496
501
QueryPoolStateCmdArgs
497
502
<$> pQueryCommons era envCli
498
503
<*> pAllStakePoolsOrSome
499
- <*> pFormatFlags
500
- " pool-state query output "
504
+ <*> pFormatQueryOutputFlags
505
+ " pool-state"
501
506
[ flagFormatJson & setDefault
502
507
, flagFormatYaml
503
508
]
@@ -513,8 +518,8 @@ pQueryTxMempoolCmd envCli =
513
518
<*> pSocketPath envCli
514
519
)
515
520
<*> pTxMempoolQuery
516
- <*> pFormatFlags
517
- " tx-mempool query output "
521
+ <*> pFormatQueryOutputFlags
522
+ " tx-mempool"
518
523
[ flagFormatJson & setDefault
519
524
, flagFormatYaml
520
525
]
@@ -546,8 +551,8 @@ pLeadershipScheduleCmd era envCli =
546
551
<*> pStakePoolVerificationKeyOrHashOrFile Nothing
547
552
<*> pVrfSigningKeyFile
548
553
<*> pWhichLeadershipSchedule
549
- <*> pFormatFlags
550
- " leadership-schedule query output "
554
+ <*> pFormatQueryOutputFlags
555
+ " leadership-schedule"
551
556
[ flagFormatJson & setDefault
552
557
, flagFormatText
553
558
, flagFormatYaml
@@ -560,8 +565,8 @@ pKesPeriodInfoCmd era envCli =
560
565
QueryKesPeriodInfoCmdArgs
561
566
<$> pQueryCommons era envCli
562
567
<*> pOperationalCertificateFile
563
- <*> pFormatFlags
564
- " kes-period-info query output "
568
+ <*> pFormatQueryOutputFlags
569
+ " kes-period-info"
565
570
[ flagFormatJson & setDefault
566
571
, flagFormatYaml
567
572
]
@@ -587,10 +592,11 @@ pQueryRefScriptSizeCmd era envCli =
587
592
QueryRefScriptSizeCmdArgs
588
593
<$> pQueryCommons era envCli
589
594
<*> (fromList <$> some pByTxIn)
590
- <*> pFormatFlags
591
- " reference inputs query output "
595
+ <*> pFormatQueryOutputFlags
596
+ " reference-script-size "
592
597
[ flagFormatJson & setDefault
593
598
, flagFormatText
599
+ , flagFormatYaml
594
600
]
595
601
<*> pMaybeOutputFile
596
602
where
@@ -692,8 +698,8 @@ pQueryDRepStateCmd era envCli = do
692
698
]
693
699
]
694
700
)
695
- <*> pFormatFlags
696
- " drep-state query output "
701
+ <*> pFormatQueryOutputFlags
702
+ " drep-state"
697
703
[ flagFormatJson & setDefault
698
704
, flagFormatYaml
699
705
]
@@ -718,8 +724,8 @@ pQueryDRepStakeDistributionCmd era envCli = do
718
724
QueryDRepStakeDistributionCmdArgs w
719
725
<$> pQueryCommons era envCli
720
726
<*> pAllOrOnlyDRepHashSource
721
- <*> pFormatFlags
722
- " drep-stake-distribution query output "
727
+ <*> pFormatQueryOutputFlags
728
+ " drep-stake-distribution"
723
729
[ flagFormatJson & setDefault
724
730
, flagFormatYaml
725
731
]
@@ -747,8 +753,8 @@ pQueryProposalsCmd era envCli = do
747
753
QueryProposalsCmdArgs w
748
754
<$> pQueryCommons (convert w) envCli
749
755
<*> pAllOrOnlyGovActionIds
750
- <*> pFormatFlags
751
- " proposals query output "
756
+ <*> pFormatQueryOutputFlags
757
+ " proposals"
752
758
[ flagFormatJson & setDefault
753
759
, flagFormatYaml
754
760
]
@@ -773,8 +779,8 @@ pQuerySPOStakeDistributionCmd era envCli = do
773
779
QuerySPOStakeDistributionCmdArgs w
774
780
<$> pQueryCommons era envCli
775
781
<*> pAllOrOnlySPOHashSource
776
- <*> pFormatFlags
777
- " spo-stake-distribution query output "
782
+ <*> pFormatQueryOutputFlags
783
+ " spo-stake-distribution"
778
784
[ flagFormatJson & setDefault
779
785
, flagFormatYaml
780
786
]
@@ -801,8 +807,8 @@ pQueryGetCommitteeStateCmd era envCli = do
801
807
<*> many pCommitteeColdVerificationKeyOrHashOrFileOrScriptHash
802
808
<*> many pCommitteeHotKeyOrHashOrFileOrScriptHash
803
809
<*> many pMemberStatus
804
- <*> pFormatFlags
805
- " committee-state query output "
810
+ <*> pFormatQueryOutputFlags
811
+ " committee-state"
806
812
[ flagFormatJson & setDefault
807
813
, flagFormatYaml
808
814
]
@@ -889,8 +895,8 @@ pQueryStakePoolDefaultVote era envCli = do
889
895
QueryStakePoolDefaultVoteCmdArgs w
890
896
<$> pQueryCommons era envCli
891
897
<*> pSPOHashSource
892
- <*> pFormatFlags
893
- " stake-pool-default-vote query output "
898
+ <*> pFormatQueryOutputFlags
899
+ " stake-pool-default-vote"
894
900
[ flagFormatJson & setDefault
895
901
, flagFormatYaml
896
902
]
@@ -906,8 +912,8 @@ pQueryNoArgCmdArgs
906
912
pQueryNoArgCmdArgs w envCli name =
907
913
QueryNoArgCmdArgs w
908
914
<$> pQueryCommons (convert w) envCli
909
- <*> pFormatFlags
910
- ( name <> " query output " )
915
+ <*> pFormatQueryOutputFlags
916
+ name
911
917
[ flagFormatJson & setDefault
912
918
, flagFormatYaml
913
919
]
@@ -951,3 +957,10 @@ pQueryEraHistoryCmd envCli =
951
957
QueryEraHistoryCmdArgs
952
958
<$> pQueryCommons ShelleyBasedEraConway envCli
953
959
<*> pMaybeOutputFile
960
+
961
+ pFormatQueryOutputFlags
962
+ :: String
963
+ -> [Flag (Vary fs )]
964
+ -> Parser (Vary fs )
965
+ pFormatQueryOutputFlags content =
966
+ pFormatFlags $ content <> " query output"
0 commit comments