-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
--line-number-width doesn't work well with --no-heading #795
Comments
Sorry, but this will never work. The whole point of |
Perhaps I'm overlooking something, but could the padded line number be
printed before the file path on each line?
…On Tue, Feb 13, 2018 at 1:12 PM, Andrew Gallant ***@***.***> wrote:
Sorry, but this will never work. The whole point of --line-number-width
is to specify a fixed padding. There is no intelligent "alignment" going
on. We can either let this bug stand or mark --no-heading as a
conflicting flag with --line-number-width.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#795 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABwFepYMXPeSewHv2OI-lpDFByyT27zGks5tUXxDgaJpZM4SDeeA>
.
|
@erikrw It could, but it won't happen. That's not the standard grep output format. |
I'm regretting ever adding this flag. I wish I considered this output format, because if I had, I would have never let this flag be a thing. This is absolutely not something that ripgrep will ever fix because we are not going to get into the business of "aligning" output. I thought we could get away with something simple, but I didn't think carefully about the interaction with |
i can live without this but what would be controversial about the following: (requires monospace font, the | are aligned)
NOTE: user specifies minimum distance between | and left margin, same as using printf padding: |
@timotheecour That doesn't align the line numbers, which I thought was the point of |
well maybe the flag could be renamed to something more general, like The intent i had in mind is to have aligned output in essentially 2 columns: one with file/line/col, the other with the data
not sure I understand that 2nd point, but the point is to align in 2 columns (analog to how sql output is aligned in columns, eg
|
What value do you give to |
the location of each
user responsability to give a big enough one; if too small, not a big deal (see above point). Unless Again, that's just an option... |
@timotheecour Thanks for explaining! But yeah basically ripgrep isn't in the business of aligning things since it won't buffer all output into memory. I basically am now of the opinion that these flags are too error prone and don't fit well into ripgrep. |
sure. I'm really curious though (and sorry if it was already explained, if it is, thanks for the link) but what is downside of buffering output as an option? (orthogonal to this issue)
each thread would collect output into its own thread local buffer (up to max-stored-lines/num_threads, and maybe optionally dump to stdout if it exceeds buffer size) For all the queries I've ever done, output size is always fits in memory (and if it exceeds passed in buffer size it can just output to stdout) enabling use cases:
|
Because I don't think every possible thing should be an option. I care about UX and maintainability, and part of that is managing the number of flags ripgrep supports. It needs to be OK for me to say No to some things. If you care about output format this much, then it would be better to parse the results and re-display them in a format of your liking. That way, you can make the trade offs that make sense for your specific usage. (There is a ticket for enabling ripgrep to output results in a more structured format.) |
sructured output format would indeed solve all the use cases, ok thx (#359 + other i guess) |
Yes, that's the one!
…On Feb 13, 2018 7:37 PM, "Timothee Cour" ***@***.***> wrote:
There is a ticket for enabling ripgrep to output results in a more
structured format.
sructured output format would indeed solve all the use cases, ok thx (
#244 <#244> ?)
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#795 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAb34kmQI6b2xhap7AzUo27Fk-xMEKpbks5tUirggaJpZM4SDeeA>
.
|
What version of ripgrep are you using?
ripgrep 0.8.0 (rev )
-SIMD -AVX
What operating system are you using ripgrep on?
osx
what i'm observing:
rg --no-heading --line-number-width=10 packages
what i'd expect
that the line numbers would align WRT left margin (ie that they'd all lign up), not that they'd align WRT rightmost character of path (which has variable position due to different path lengths)
The text was updated successfully, but these errors were encountered: