Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mpilgrem
Copy link
Collaborator

See:

This uses LineSeparatedList so that:

flags:
  my-flag:
    description: |
      This is some text

      This is more some text
    manual: true
    default: true

renders as:

flag my-flag
  description:
      This is some text
      .
      This is more some text
  manual: True
  default: True

otherwise I could not see how to avoid ugly rendering.

@mpilgrem mpilgrem requested a review from sol October 23, 2025 22:32
@mpilgrem
Copy link
Collaborator Author

The CI is failing for reasons unrelated to this pull request. See:

Copy link

@sellout sellout left a comment

Choose a reason for hiding this comment

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

This looks good as far as I can tell. Shares code with the existing description formatting, looks like it correctly handles Cabal versioning 👍

@sol
Copy link
Owner

sol commented Oct 24, 2025

See:

This uses LineSeparatedList so that:

flags:
  my-flag:
    description: |
      This is some text

      This is more some text
    manual: true
    default: true

renders as:

flag my-flag
  description:
      This is some text
      .
      This is more some text
  manual: True
  default: True

otherwise I could not see how to avoid ugly rendering.

What does ugly rendering mean?

Something like this?

flag my-flag
  description: This is some text
               .
               This is more some text
  manual: True
  default: True

@sol
Copy link
Owner

sol commented Oct 25, 2025

@mpilgrem I'm gonna do a review, but can you please give me feedback on my question first?

@mpilgrem
Copy link
Collaborator Author

@sol, I am away from a machine, but the short answer is: in part. With a Literal the indentation is 'coded' in the value, so you have to 'hard code' that the start of description: for a flag stanza will be two spaces in from the left.

With a LineSeparatedList, I did not need to encode indentation in the value. A different type of hack, I suppose...

@mpilgrem
Copy link
Collaborator Author

One thing I have not checked, but needs to be understood, is how Hackage renders a multi-paragraph description for a flag.

(I know how Hackage renders a long description, because the stack package provides examples of those.)

@@ -1,3 +1,6 @@
## UNRELEASED
- Handle a multi-line value for the `description` key of a flag (see #623)
Copy link
Owner

@sol sol Oct 24, 2025

Choose a reason for hiding this comment

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

I would tend to release this straightaway as 0.38.3.

- http-client-tls >= 0.3.6.2
- vector
- infer-license >= 0.2.0 && < 0.3
- crypton-x509-store < 1.6.12 || > 1.6.12
Copy link
Owner

Choose a reason for hiding this comment

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

What is the issue with that version?

As this is not a direct dependency, I'm not eager to include this in the package description.

Could this be addressed as a Hackage revision instead?

Copy link
Collaborator Author

@mpilgrem mpilgrem Oct 25, 2025

Choose a reason for hiding this comment

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

See: kazu-yamamoto/crypton-certificate#21

This was intended only as a temporary fix, to allow the Hpack CI to run (as it uses Cabal).

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, ok, thanks.

This should be addressed by a Hackage revision.

where
description = maybe [] (return . Field "description" . Literal) flagDescription
description = maybe [] (return . Field "description" . LineSeparatedList) formattedFlagDescription
formattedFlagDescription = formatDescription' cabalVersion <$> flagDescription
Copy link
Owner

@sol sol Oct 25, 2025

Choose a reason for hiding this comment

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

From what I understand, formatDescription functionally works here, and I think that is what you should use.

While technically, I guess, I would prefer two spaces of indentation, it does not justify misusing LineSeparatedList (at least not by my book).

Copy link
Owner

Choose a reason for hiding this comment

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

To elaborate on this, from what i understand, using LineSeparatedList produces

  description:
      This is some text

and

  description:
      This is some text
      .
      This is more some text

while using formatDescription would produce

  description: This is some text

and

  description: This is some text
               .
               This is more some text

While you could argue the multi-line formatting is indeed nicer with LineSeparatedList, for single-line descriptions I prefer what formatDescription produces. That means, LineSeparatedList is not strictly better than formatDescription, but using formatDescription is strictly cleaner, code wise, than using LineSeparatedList.

If anything, we would want to extend the formatting abilities of formatDescription, but even that is not very high on my priority list.

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