Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query stake-pools: add --output-[json,text] flag to control format of the output #617

Merged
merged 3 commits into from
Feb 22, 2024

Conversation

smelc
Copy link
Contributor

@smelc smelc commented Feb 22, 2024

Changelog

- description: |
    query stake-pools, add --output-[json,text] flag to control format of the output
# uncomment types applicable to the change:
  type:
  - feature        # introduces a new feature
  # - breaking       # the API has changed in a breaking way
  - compatible     # the API has changed but is non-breaking
  # - optimisation   # measurable performance improvements
  # - improvement    # QoL changes e.g. refactoring
  # - bugfix         # fixes a defect
  # - test           # fixes/modifies tests
  # - maintenance    # not directly related to the code
  # - release        # related to a new release preparation
  # - documentation  # change in code docs, haddocks...

Context

How to trust this PR

  1. See is the output of query stake-pools before this PR (so no using the new flags): https://github.com/IntersectMBO/cardano-node/blob/smelc/test-cardano-cli-query-stake-pools-output-new/log.txt
  2. See the output of query stake-pools after this PR, when not using the new flags, so clunky defaults: https://github.com/IntersectMBO/cardano-node/blob/smelc/test-cardano-cli-query-stake-pools-output-new/log_new.txt. Note it's the same as item 1.
  3. See the output of query stake-pools after this PR, when using all combinations of new flags: https://github.com/IntersectMBO/cardano-node/blob/smelc/test-cardano-cli-query-stake-pools-output-new/log_all_new_cases.txt Notice the behaviors are the expected ones for all combinations.

Checklist

  • Commit sequence broadly makes sense and commits have useful messages
  • Self-reviewed the diff

@smelc smelc marked this pull request as ready for review February 22, 2024 19:35
@smelc smelc force-pushed the smelc/query-stake-pools-control-output-format branch from 02b75f9 to c4f4636 Compare February 22, 2024 19:39
(Nothing, Nothing) -> QueryOutputFormatText -- No CLI flag, writing to stdout: write text
(Nothing, Just _) -> QueryOutputFormatJson -- No CLI flag, writing to a file: write JSON

textToLazyBytestring :: Text -> LBS.ByteString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't work, because my function converts strict Text to a lazy bytestring.

So I changed the function's name to strictTextToLazyBytestring to make that more apparent. It was misleading 👍

Copy link
Contributor

@Jimbo4350 Jimbo4350 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! One comment

@smelc smelc force-pushed the smelc/query-stake-pools-control-output-format branch from c4f4636 to b3964aa Compare February 22, 2024 19:59
@smelc smelc enabled auto-merge February 22, 2024 20:02
@smelc smelc added this pull request to the merge queue Feb 22, 2024
Merged via the queue into main with commit 615beb8 Feb 22, 2024
15 of 16 checks passed
@smelc smelc deleted the smelc/query-stake-pools-control-output-format branch February 22, 2024 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants