-
-
Notifications
You must be signed in to change notification settings - Fork 2k
nix flake show: add the description if it exists #10980
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
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
547e808
nix flake show: add the description if it exists
kjeremy 07d0527
nix flake show: Only print up to the first new line if it exists.
kjeremy 59b6aaf
add tests
kjeremy f22cf1f
Handle long strings, embedded new lines and empty descriptions
kjeremy 930818b
Account for total length of 80
kjeremy 1c5f1de
copy string using filterANSIEscapes and enforce the max length
kjeremy 9bf6684
Use window size
kjeremy abbaba9
Use the window size for the entire length
kjeremy d49e14b
Take ANSI and tree characters into account
kjeremy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 the
FIXME:here. I think this is pretty close but it's not 100% correct yet.filterANSIEscapes(..., true)seems to give a reasonable character count but I'm losing color information.filterANSIEscapes(..., false)gives funky length values so I think I'm missing something.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.
@edolstra @tomberek it's close! but I'm missing something with the escapes:
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.
there might be a known number of escapes that you need to correct for, but then also use the original line (plus some terminating ANSI codes). Perhaps do:
Uh oh!
There was an error while loading. Please reload this page.
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.
This is all fairly terrible. The filtering function definitely doesn't strip ascii codes out and this all depends on the nested level.
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.
Is there a less perfect solution we could implement for now?
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.
It would be nice if
filterANSIEscapesfiltered out color codes.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.
The new version uses a modified version of
filterANSIEscapeswith the tree characters taken into account. It's kind of ugly but seems to work!Uh oh!
There was an error while loading. Please reload this page.
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.
Absolutely. Terminal color logic, layout logic and flake attribute logic should all be separated out into distinct functions, classes, etc.
However, since we know the solution for the tech debt and we're not dealing with crazy compatibility requirements in this part of the code, I'd be happy to merge this and do the refactoring after.
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.
That would be great
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.
@roberth Are we good to go as-is?