Skip to content

Commit 83170a2

Browse files
committed
Consistent use outputFormat as the name of the output format field
1 parent 663d75e commit 83170a2

File tree

11 files changed

+49
-51
lines changed

11 files changed

+49
-51
lines changed

cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Command.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ data GovernanceActionViewCmdArgs era
158158
= GovernanceActionViewCmdArgs
159159
{ eon :: !(ConwayEraOnwards era)
160160
, actionFile :: !(ProposalFile In)
161-
, outFormat :: !(Vary [FormatJson, FormatYaml])
161+
, outputFormat :: !(Vary [FormatJson, FormatYaml])
162162
, mOutFile :: !(Maybe (File () Out))
163163
}
164164
deriving Show

cardano-cli/src/Cardano/CLI/EraBased/Governance/Actions/Run.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,16 @@ runGovernanceActionViewCmd
6464
-> CIO e ()
6565
runGovernanceActionViewCmd
6666
Cmd.GovernanceActionViewCmdArgs
67-
{ Cmd.outFormat
68-
, Cmd.actionFile
67+
{ Cmd.actionFile
68+
, Cmd.outputFormat
6969
, Cmd.mOutFile
7070
, Cmd.eon
7171
} = do
7272
proposal <-
7373
fromEitherIOCli $
7474
readProposal eon (actionFile, Nothing)
7575

76-
void $ friendlyProposal outFormat mOutFile eon $ fst proposal
76+
void $ friendlyProposal outputFormat mOutFile eon $ fst proposal
7777

7878
runGovernanceActionInfoCmd
7979
:: forall era e

cardano-cli/src/Cardano/CLI/EraBased/Governance/Vote/Command.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ data GovernanceVoteCreateCmdArgs era
4545
data GovernanceVoteViewCmdArgs era
4646
= GovernanceVoteViewCmdArgs
4747
{ eon :: ConwayEraOnwards era
48-
, outFormat :: !(Vary [FormatJson, FormatYaml])
4948
, voteFile :: VoteFile In
49+
, outputFormat :: !(Vary [FormatJson, FormatYaml])
5050
, mOutFile :: Maybe (File () Out)
5151
}
5252

cardano-cli/src/Cardano/CLI/EraBased/Governance/Vote/Option.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,10 @@ pGovernanceVoteViewCmd era = do
9191
pGovernanceVoteViewCmdArgs :: ConwayEraOnwards era -> Parser (GovernanceVoteViewCmdArgs era)
9292
pGovernanceVoteViewCmdArgs cOnwards =
9393
GovernanceVoteViewCmdArgs cOnwards
94-
<$> pFormatFlags
94+
<$> pFileInDirection "vote-file" "Input filepath of the vote."
95+
<*> pFormatFlags
9596
"governance vote view output"
9697
[ flagFormatJson & setDefault
9798
, flagFormatYaml
9899
]
99-
<*> pFileInDirection "vote-file" "Input filepath of the vote."
100100
<*> pMaybeOutputFile

cardano-cli/src/Cardano/CLI/EraBased/Governance/Vote/Run.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ runGovernanceVoteViewCmd
103103
runGovernanceVoteViewCmd
104104
Cmd.GovernanceVoteViewCmdArgs
105105
{ eon
106-
, outFormat
107106
, voteFile
107+
, outputFormat
108108
, mOutFile
109109
} = do
110110
let sbe :: ShelleyBasedEra era = convert eon
@@ -116,7 +116,7 @@ runGovernanceVoteViewCmd
116116
readVoteScriptWitness eon (voteFile, Nothing)
117117

118118
let output =
119-
outFormat
119+
outputFormat
120120
& ( id
121121
. Vary.on (\FormatJson -> Json.encodeJson)
122122
. Vary.on (\FormatYaml -> Json.encodeYaml)

cardano-cli/src/Cardano/CLI/EraBased/Query/Command.hs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,35 +94,35 @@ data QueryLeadershipScheduleCmdArgs = QueryLeadershipScheduleCmdArgs
9494
, poolColdVerKeyFile :: !StakePoolKeyHashSource
9595
, vrkSkeyFp :: !(SigningKeyFile In)
9696
, whichSchedule :: !EpochLeadershipSchedule
97-
, format :: !(Vary [FormatJson, FormatText, FormatYaml])
97+
, outputFormat :: !(Vary [FormatJson, FormatText, FormatYaml])
9898
, mOutFile :: !(Maybe (File () Out))
9999
}
100100
deriving (Generic, Show)
101101

102102
data QueryProtocolParametersCmdArgs = QueryProtocolParametersCmdArgs
103103
{ nodeConnInfo :: !LocalNodeConnectInfo
104-
, outFormat :: !(Vary [FormatJson, FormatYaml])
104+
, outputFormat :: !(Vary [FormatJson, FormatYaml])
105105
, mOutFile :: !(Maybe (File () Out))
106106
}
107107
deriving (Generic, Show)
108108

109109
data QueryTipCmdArgs = QueryTipCmdArgs
110110
{ commons :: !QueryCommons
111-
, outFormat :: !(Vary [FormatJson, FormatYaml])
111+
, outputFormat :: !(Vary [FormatJson, FormatYaml])
112112
, mOutFile :: !(Maybe (File () Out))
113113
}
114114
deriving (Generic, Show)
115115

116116
data QueryStakePoolsCmdArgs = QueryStakePoolsCmdArgs
117117
{ commons :: !QueryCommons
118-
, format :: !(Vary [FormatJson, FormatText])
118+
, outputFormat :: !(Vary [FormatJson, FormatText])
119119
, mOutFile :: !(Maybe (File () Out))
120120
}
121121
deriving (Generic, Show)
122122

123123
data QueryStakeDistributionCmdArgs = QueryStakeDistributionCmdArgs
124124
{ commons :: !QueryCommons
125-
, format :: !(Vary [FormatJson, FormatText])
125+
, outputFormat :: !(Vary [FormatJson, FormatText])
126126
, mOutFile :: !(Maybe (File () Out))
127127
}
128128
deriving (Generic, Show)
@@ -138,7 +138,7 @@ data QueryStakeAddressInfoCmdArgs = QueryStakeAddressInfoCmdArgs
138138
data QueryUTxOCmdArgs = QueryUTxOCmdArgs
139139
{ commons :: !QueryCommons
140140
, queryFilter :: !QueryUTxOFilter
141-
, format :: !(Vary [FormatCbor, FormatJson, FormatText])
141+
, outputFormat :: !(Vary [FormatCbor, FormatJson, FormatText])
142142
, mOutFile :: !(Maybe (File () Out))
143143
}
144144
deriving (Generic, Show)
@@ -175,7 +175,7 @@ data QueryKesPeriodInfoCmdArgs = QueryKesPeriodInfoCmdArgs
175175
{ commons :: !QueryCommons
176176
, nodeOpCertFp :: !(File () In)
177177
-- ^ Node operational certificate
178-
, outFormat :: !(Vary [FormatJson, FormatYaml])
178+
, outputFormat :: !(Vary [FormatJson, FormatYaml])
179179
, mOutFile :: !(Maybe (File () Out))
180180
}
181181
deriving (Generic, Show)
@@ -191,7 +191,7 @@ data QueryPoolStateCmdArgs = QueryPoolStateCmdArgs
191191
data QueryTxMempoolCmdArgs = QueryTxMempoolCmdArgs
192192
{ nodeConnInfo :: !LocalNodeConnectInfo
193193
, query :: !TxMempoolQuery
194-
, outFormat :: !(Vary [FormatJson, FormatYaml])
194+
, outputFormat :: !(Vary [FormatJson, FormatYaml])
195195
, mOutFile :: !(Maybe (File () Out))
196196
}
197197
deriving (Generic, Show)
@@ -205,7 +205,7 @@ data QuerySlotNumberCmdArgs = QuerySlotNumberCmdArgs
205205
data QueryRefScriptSizeCmdArgs = QueryRefScriptSizeCmdArgs
206206
{ commons :: !QueryCommons
207207
, transactionInputs :: !(Set TxIn)
208-
, format :: !(Vary [FormatJson, FormatText])
208+
, outputFormat :: !(Vary [FormatJson, FormatText])
209209
, mOutFile :: !(Maybe (File () Out))
210210
}
211211
deriving (Generic, Show)

cardano-cli/src/Cardano/CLI/EraBased/Query/Run.hs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ runQueryProtocolParametersCmd
140140
runQueryProtocolParametersCmd
141141
Cmd.QueryProtocolParametersCmdArgs
142142
{ Cmd.nodeConnInfo
143-
, Cmd.outFormat
143+
, Cmd.outputFormat
144144
, Cmd.mOutFile
145145
} = do
146146
AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ determineEra nodeConnInfo
@@ -154,7 +154,7 @@ runQueryProtocolParametersCmd
154154

155155
let output =
156156
shelleyBasedEraConstraints sbe
157-
$ outFormat
157+
$ outputFormat
158158
& ( id
159159
. Vary.on (\FormatJson -> Json.encodeJson)
160160
. Vary.on (\FormatYaml -> Json.encodeYaml)
@@ -212,7 +212,7 @@ runQueryTipCmd
212212
{ Cmd.nodeConnInfo
213213
, Cmd.target
214214
}
215-
, Cmd.outFormat
215+
, Cmd.outputFormat
216216
, Cmd.mOutFile
217217
}
218218
) = do
@@ -294,7 +294,7 @@ runQueryTipCmd
294294
}
295295

296296
let output =
297-
outFormat
297+
outputFormat
298298
& ( id
299299
. Vary.on (\FormatJson -> Json.encodeJson)
300300
. Vary.on (\FormatYaml -> Json.encodeYaml)
@@ -320,7 +320,7 @@ runQueryUTxOCmd
320320
, Cmd.target
321321
}
322322
, Cmd.queryFilter
323-
, Cmd.format
323+
, Cmd.outputFormat
324324
, Cmd.mOutFile
325325
}
326326
) = do
@@ -336,7 +336,7 @@ runQueryUTxOCmd
336336
utxo <- easyRunQuery (queryUtxo sbe queryFilter)
337337

338338
pure $ do
339-
writeFilteredUTxOs sbe format mOutFile utxo
339+
writeFilteredUTxOs sbe outputFormat mOutFile utxo
340340
)
341341
& onLeft (left . QueryCmdAcquireFailure)
342342
& onLeft left
@@ -353,7 +353,7 @@ runQueryKesPeriodInfoCmd
353353
, Cmd.target
354354
}
355355
, Cmd.nodeOpCertFp
356-
, Cmd.outFormat
356+
, Cmd.outputFormat
357357
, Cmd.mOutFile
358358
} = do
359359
opCert <-
@@ -403,7 +403,7 @@ runQueryKesPeriodInfoCmd
403403

404404
let qKesInfoOutput = createQueryKesPeriodInfoOutput opCertIntervalInformation counterInformation eInfo gParams
405405
output =
406-
outFormat
406+
outputFormat
407407
& ( id
408408
. Vary.on (\FormatJson -> Json.encodeJson)
409409
. Vary.on (\FormatYaml -> Json.encodeYaml)
@@ -686,7 +686,7 @@ runQueryTxMempoolCmd
686686
Cmd.QueryTxMempoolCmdArgs
687687
{ Cmd.nodeConnInfo
688688
, Cmd.query
689-
, Cmd.outFormat
689+
, Cmd.outputFormat
690690
, Cmd.mOutFile
691691
} = do
692692
localQuery <- case query of
@@ -701,7 +701,7 @@ runQueryTxMempoolCmd
701701
result <- liftIO $ queryTxMonitoringLocal nodeConnInfo localQuery
702702

703703
let output =
704-
outFormat
704+
outputFormat
705705
& ( id
706706
. Vary.on (\FormatJson -> Json.encodeJson)
707707
. Vary.on (\FormatYaml -> Json.encodeYaml)
@@ -741,7 +741,7 @@ runQueryRefScriptSizeCmd
741741
, Cmd.target
742742
}
743743
, Cmd.transactionInputs
744-
, Cmd.format
744+
, Cmd.outputFormat
745745
, Cmd.mOutFile
746746
} = do
747747
join $
@@ -758,7 +758,7 @@ runQueryRefScriptSizeCmd
758758
utxo <- easyRunQuery (queryUtxo sbe $ QueryUTxOByTxIn transactionInputs)
759759

760760
pure $
761-
writeFormattedOutput format mOutFile $
761+
writeFormattedOutput outputFormat mOutFile $
762762
RefInputScriptSize $
763763
getReferenceInputsSizeForTxIds beo (toLedgerUTxO sbe utxo) transactionInputs
764764
)
@@ -1373,7 +1373,7 @@ runQueryStakePoolsCmd
13731373
{ Cmd.nodeConnInfo
13741374
, Cmd.target
13751375
}
1376-
, Cmd.format
1376+
, Cmd.outputFormat
13771377
, Cmd.mOutFile
13781378
} = do
13791379
join $
@@ -1387,7 +1387,7 @@ runQueryStakePoolsCmd
13871387

13881388
poolIds <- easyRunQuery (queryStakePools sbe)
13891389

1390-
pure $ writeStakePools format mOutFile poolIds
1390+
pure $ writeStakePools outputFormat mOutFile poolIds
13911391
)
13921392
& onLeft (left . QueryCmdAcquireFailure)
13931393
& onLeft left
@@ -1450,7 +1450,7 @@ runQueryStakeDistributionCmd
14501450
{ Cmd.nodeConnInfo
14511451
, Cmd.target
14521452
}
1453-
, Cmd.format
1453+
, Cmd.outputFormat
14541454
, Cmd.mOutFile
14551455
} = do
14561456
join $
@@ -1465,7 +1465,7 @@ runQueryStakeDistributionCmd
14651465
result <- easyRunQuery (queryStakeDistribution sbe)
14661466

14671467
pure $ do
1468-
writeStakeDistribution format mOutFile result
1468+
writeStakeDistribution outputFormat mOutFile result
14691469
)
14701470
& onLeft (left . QueryCmdAcquireFailure)
14711471
& onLeft left
@@ -1520,7 +1520,7 @@ runQueryLeadershipScheduleCmd
15201520
, Cmd.poolColdVerKeyFile
15211521
, Cmd.vrkSkeyFp
15221522
, Cmd.whichSchedule
1523-
, Cmd.format
1523+
, Cmd.outputFormat
15241524
, Cmd.mOutFile
15251525
} = do
15261526
poolid <- getHashFromStakePoolKeyHashSource poolColdVerKeyFile
@@ -1603,7 +1603,7 @@ runQueryLeadershipScheduleCmd
16031603
writeSchedule mOutFile' eInfo shelleyGenesis schedule = do
16041604
let start = SystemStart $ sgSystemStart shelleyGenesis
16051605
output =
1606-
format
1606+
outputFormat
16071607
& ( id
16081608
. Vary.on (\FormatJson -> Json.encodeJson $ leadershipScheduleToJson schedule eInfo start)
16091609
. Vary.on (\FormatText -> strictTextToLazyBytestring $ leadershipScheduleToText schedule eInfo start)

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1770,8 +1770,8 @@ Usage: cardano-cli conway governance vote create (--yes | --no | --abstain)
17701770

17711771
Vote creation.
17721772

1773-
Usage: cardano-cli conway governance vote view [--output-json | --output-yaml]
1774-
--vote-file FILEPATH
1773+
Usage: cardano-cli conway governance vote view --vote-file FILEPATH
1774+
[--output-json | --output-yaml]
17751775
[--out-file FILEPATH]
17761776

17771777
Vote viewing.
@@ -4031,8 +4031,8 @@ Usage: cardano-cli latest governance vote create (--yes | --no | --abstain)
40314031

40324032
Vote creation.
40334033

4034-
Usage: cardano-cli latest governance vote view [--output-json | --output-yaml]
4035-
--vote-file FILEPATH
4034+
Usage: cardano-cli latest governance vote view --vote-file FILEPATH
4035+
[--output-json | --output-yaml]
40364036
[--out-file FILEPATH]
40374037

40384038
Vote viewing.
@@ -7323,11 +7323,10 @@ Usage: cardano-cli compatible conway governance vote create
73237323

73247324
Vote creation.
73257325

7326-
Usage: cardano-cli compatible conway governance vote view
7326+
Usage: cardano-cli compatible conway governance vote view --vote-file FILEPATH
73277327
[ --output-json
73287328
| --output-yaml
73297329
]
7330-
--vote-file FILEPATH
73317330
[--out-file FILEPATH]
73327331

73337332
Vote viewing.
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
Usage: cardano-cli compatible conway governance vote view
1+
Usage: cardano-cli compatible conway governance vote view --vote-file FILEPATH
22
[ --output-json
33
| --output-yaml
44
]
5-
--vote-file FILEPATH
65
[--out-file FILEPATH]
76

87
Vote viewing.
98

109
Available options:
10+
--vote-file FILEPATH Input filepath of the vote.
1111
--output-json Format governance vote view output to JSON (default).
1212
--output-yaml Format governance vote view output to YAML.
13-
--vote-file FILEPATH Input filepath of the vote.
1413
--out-file FILEPATH Optional output file. Default is to write to stdout.
1514
-h,--help Show this help text
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Usage: cardano-cli conway governance vote view [--output-json | --output-yaml]
2-
--vote-file FILEPATH
1+
Usage: cardano-cli conway governance vote view --vote-file FILEPATH
2+
[--output-json | --output-yaml]
33
[--out-file FILEPATH]
44

55
Vote viewing.
66

77
Available options:
8+
--vote-file FILEPATH Input filepath of the vote.
89
--output-json Format governance vote view output to JSON (default).
910
--output-yaml Format governance vote view output to YAML.
10-
--vote-file FILEPATH Input filepath of the vote.
1111
--out-file FILEPATH Optional output file. Default is to write to stdout.
1212
-h,--help Show this help text
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Usage: cardano-cli latest governance vote view [--output-json | --output-yaml]
2-
--vote-file FILEPATH
1+
Usage: cardano-cli latest governance vote view --vote-file FILEPATH
2+
[--output-json | --output-yaml]
33
[--out-file FILEPATH]
44

55
Vote viewing.
66

77
Available options:
8+
--vote-file FILEPATH Input filepath of the vote.
89
--output-json Format governance vote view output to JSON (default).
910
--output-yaml Format governance vote view output to YAML.
10-
--vote-file FILEPATH Input filepath of the vote.
1111
--out-file FILEPATH Optional output file. Default is to write to stdout.
1212
-h,--help Show this help text

0 commit comments

Comments
 (0)