-
Notifications
You must be signed in to change notification settings - Fork 724
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
Fix CLI help formatting #2945
Fix CLI help formatting #2945
Conversation
856d4e2
to
1b3ab31
Compare
Before:
After:
|
In order to get the traced version of the output for inspection in a browser, supply
|
14ff79f
to
74b8291
Compare
@newhoggy Much improved overall. There's just a couple of things bugging me and causing misalignment. Neither of these are serious.
|
Yeah, ideally, I want it to look like this:
ie. space after the bracket/parens if the group spans more than one line, but no space otherwise. Unfortunately the layout code is fairly complex and I haven't yet worked it out even after spending over a day on it. The whole layout code may need a rewrite to achieve the right effect. I'm interest in merging this on the basis that it is an improvement. |
d47d057
to
0d7d239
Compare
@@ -107,6 +107,18 @@ package cardano-ledger-alonzo-test | |||
-- --------------------------- 8< -------------------------- | |||
-- Please do not put any `source-repository-package` clause above this line. | |||
|
|||
source-repository-package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we leave a comment that we want to eventually not rely on our own fork after the relevant PR has been merged?
import qualified System.IO.Unsafe as IO | ||
|
||
cliHelpTraceEnabled :: Bool | ||
cliHelpTraceEnabled = IO.unsafePerformIO $ do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have any experience using unsafePerformIO
. Is this ok to use here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes this seems to be a safe use of unsafePerformIO
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. This example of unsafePerformIO
is fairly normal. unsafePerformIO
is used to perform some IO to initialise a global constant. The danger is if the side effect is executed more than once which can happen if the constant is inlined into the callsite, in which case the constant is not so constant, but this is prevent by the NOINLINE
pragma. This forces the value to be a thunk that can only be evaluated once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See documentation on unsafePerformIO
: https://hackage.haskell.org/package/base-4.15.0.0/docs/System-IO-Unsafe.html
cliHelpTraceEnabled = IO.unsafePerformIO $ do | ||
mValue <- IO.lookupEnv "CLI_HELP_TRACE" | ||
return $ mValue == Just "1" | ||
{-# NOINLINE cliHelpTraceEnabled #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes we need that.
bors merge |
* Switch to prettyprinter library * Tracing * Command for printing all help * Option ordering note on build-raw command
Canceled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing the tests.
Looks good to me
bors merge |
Build succeeded: |
No description provided.