Skip to content

Made ip output colored - #5356

Closed
exploide wants to merge 4 commits into
fish-shell:masterfrom
exploide:ip_colored
Closed

exploide wants to merge 4 commits into
fish-shell:masterfrom
exploide:ip_colored

Conversation

@exploide

Copy link
Copy Markdown
Contributor

Description

This PR adds a fish function that passes calls to ip to ip -c in order to make the output colored. This is similar to what is already done with grep and helps the user to quickly find the relevant information.

Fixes issue #5340

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.md

Comment thread share/functions/ip.fish Resolved
@exploide

Copy link
Copy Markdown
Contributor Author

Fixed the Mac OS X build and tests. Think it's done. Let me know if you require further changes.

Comment thread share/functions/ip.fish Resolved
Comment thread share/functions/ip.fish Resolved
@zanchey

zanchey commented Nov 20, 2018

Copy link
Copy Markdown
Member

I think we should hold this until functions in pipes are sorted out, so we don't run into the same problems we have with grep.fish.

@zanchey

zanchey commented Nov 20, 2018

Copy link
Copy Markdown
Member

Alternatively, perhaps the ip authors could be contacted to suggest that -color=auto be the default when stdout is a terminal, just like the systemd tools.

@floam

floam commented Nov 20, 2018

Copy link
Copy Markdown
Member

Does ip have any operations that print out slowly?

@exploide

Copy link
Copy Markdown
Contributor Author

I think we should hold this until functions in pipes are sorted out, so we don't run into the same problems we have with grep.fish.

That's of course up to you. But to be honest, I don't know what exactly you mean.

Does ip have any operations that print out slowly?

ip monitor is slow, for some definitions of slow...

@floam

floam commented Nov 20, 2018 •

Copy link
Copy Markdown
Member

So, grep can take a while to run, printing progress as it goes. One issue is that the way fish buffers things, when you wrap grep in a function, something_slow | grep foo is now buffered. So it's blank for however many seconds until the first command finishes, then you get the colorized output all at once.

@exploide

Copy link
Copy Markdown
Contributor Author

Ok, I see. Having ip.fish in place and executing ip monitor | command grep dev does not yield any result until I interrupt it. Then, everything is flushed.

(Besides ip monitor | grep dev i.e. both ip.fish and grep.fish in place, does not output anything at all, even after interrupting.)

@faho

faho commented Nov 27, 2018

Copy link
Copy Markdown
Member

Unfortunately, I can't find a way to get ip monitor to work properly with #1396.

So until that is solved, this is better left unmerged. So I'm closing it now, we can always reopen later.

Sorry!

@faho faho closed this Nov 27, 2018
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants