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

Tidy up query tip output #2885

Merged
merged 1 commit into from
Jun 30, 2021
Merged

Tidy up query tip output #2885

merged 1 commit into from
Jun 30, 2021

Conversation

newhoggy
Copy link
Contributor

@newhoggy newhoggy commented Jun 30, 2021

Remove unnecessary fields and ensure the output fields are in a sensible order using the toEncoding function.

@newhoggy
Copy link
Contributor Author

$ CARDANO_NODE_SOCKET_PATH=socket/node-bft1 cardano-cli query tip --testnet-magic 42 --cardano-mode
{
    "epoch": 0,
    "hash": "c2e33fd9c1cbf30bb6800e4231a6563a889f7c64d29a0c424f6af746473f5038",
    "slot": 350,
    "block": 49,
    "era": "Alonzo",
    "syncProgress": "100.00"
}

@newhoggy
Copy link
Contributor Author

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 30, 2021

@iohk-bors iohk-bors bot merged commit 3dedb28 into master Jun 30, 2021
@iohk-bors iohk-bors bot deleted the tidy-up-query-tip-output branch June 30, 2021 05:26
@@ -0,0 +1,47 @@
module Cardano.CLI.Shelley.Output
Copy link
Contributor

Choose a reason for hiding this comment

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

@newhoggy This would have been better placed in Cardano.CLI.Types rather than creating a separate module.


case mOutFile of
Just (OutputFile fpath) -> liftIO $ LBS.writeFile fpath output
Nothing -> liftIO $ LBS.putStrLn output

mode -> left (ShelleyQueryCmdUnsupportedMode (AnyConsensusMode mode))

where
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

let jsonSyncProgress = either
identity (toJSON . flip (percentage tolerance) nowSeconds) tipTimeResult

let output = encodePretty
Copy link
Contributor

@Jimbo4350 Jimbo4350 Jun 30, 2021

Choose a reason for hiding this comment

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

Nice, this is way cleaner 👍

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.

3 participants