-
Notifications
You must be signed in to change notification settings - Fork 97
[Search Processes] use ps binary unaliased #298
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
Conversation
Same as done for fd in directory search
Add -ww to the preview ps command so it will not limit its output to just one line
functions/_fzf_search_processes.fish
Outdated
_fzf_wrapper --multi \ | ||
--prompt="Search Processes> " \ | ||
--query (commandline --current-token) \ | ||
--ansi \ | ||
# first line outputted by ps is a header, so we need to mark it as so | ||
--header-lines=1 \ | ||
# ps uses exit code 1 if the process was not found, in which case show an message explaining so | ||
--preview="ps -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ | ||
--preview="$ps_cmd -ww -o '$ps_preview_fmt' -p {1} || echo 'Cannot preview {1} because it exited.'" \ |
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 -w an option available on the default ps that ships with Linux, macOS, and whatever WIndows people use (sorry I'm rusty)?
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'm not that sure about Windows, do they have their own version of ps?
Anyway for Linux I can say that it works well on my machine (Arch Linux), and also the man page has this (https://man7.org/linux/man-pages/man1/ps.1.html).
For Mac I don't have one to try, but the man page seems to also have it (https://ss64.com/osx/ps.html).
For -ww, I don't get it. I checked out this PR and used it and don't see a difference. Also, in the docs, it says "When output is not to a terminal, an unlimited number of columns are always used." Right now, ps is not outputting to a tty, so I think -w might be irrelevant. Do you have screenshots of before and after adding -ww? |
Hmm mine is also version 0.42.0. This is very odd. I surmise this is due to something specific to your setup so I'd rather not merge. However, we can at least consider the part to force using the binary instead of the alias. Of course, there's pros and cos. Maybe some people want to be able to have the alias layer to control the binary. What's your use case for the alias and why you don't want the alias for fzf? |
Bump on my question :) |
I mean there's not much to it. I have an alias for ps that is intended to prettify the output a bit but it ends up messing a bit with this code that parses ps output. I put it in a PR mainly because I saw you are doing the same with Anyway, against it's really no big deal. If you don't want to merge it it's completely fine, I'll figure out some workaround for my config. |
I'm probably going to merge this but right now I'm focused on building empathy with my users and learning about their use cases, how they use their tools in the wild. In light of that, do you mind sharing your ps alias? |
We should use the ps binary unalised because
alias ps=
on Github (source), and most of these aliases will either cause the ps command to fail or to print redundant, hard-to-parse information.