[HN Gopher] Sysz - An fzf terminal UI for systemctl
___________________________________________________________________
Sysz - An fzf terminal UI for systemctl
Author : ducktective
Score : 264 points
Date : 2021-09-18 15:09 UTC (7 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| [deleted]
| psacawa wrote:
| With fzf-tab [1], you can use fzf wherever your zsh completion
| is. Here is a screencast showing it[2].
|
| [1] https://github.com/Aloxaf/fzf-tab
|
| [2] https://asciinema.org/a/KhDMhtZ3J8ppO7B8L6jFSE1co
| sva_ wrote:
| Seems nice but it gets slow with long lists. Should lazy-load
| zamadatix wrote:
| Does anyone know of a way or how to go about making a way to get
| <tab> and <tab><tab> to bash autocomplete "systemctl status "
| with service names? It seems like remembering where the service
| name has dashes, matches the package name, has a "d" at the end,
| and so on is half the battle for me when working with systemctl.
|
| This achieves something similar but it also does a whole lot more
| than just help complete the name.
|
| Edit: Helps to have bash-completion working properly for the user
| :).
| [deleted]
| isodude wrote:
| Does it suffice with systemd's bash completion? On debian it's
| bundled with systemd. systemd: /usr/share/bash-
| completion/completions/systemctl
| xyzzy_plugh wrote:
| This works for me out of the box. Your bash profile might not
| be sourcing systemd's /usr/share/bash-
| completion/completions/systemctl or equivalent path.
|
| This host has bash 4.4.23 and systemd 247.6
| zamadatix wrote:
| Thanks for the confirmation I cleaned a few things up and the
| user profile is now loading it properly and auto-completion
| works.
| jfrunyon wrote:
| Honestly I don't understand why some distros still don't ship
| with completions for this sort of thing. Debian and Ubuntu have
| had this for the entire time they've been using systemd, as far
| as I recall. (And they've supported completion on other tools
| for even longer!)
| freedomben wrote:
| what distros don't? (honest question)
| Spivak wrote:
| The crazy thing about this is how simple the code is.
| _sysz_list_units | fzf \ --exact \
| --multi \ --ansi \ --reverse \
| --no-sort \ --history="$SYSZ_HISTORY" \
| --prompt="Units: " \ --bind
| "ctrl-v:preview('${BASH_SOURCE[0]}' _fzf_cat {})" \
| --preview="'${BASH_SOURCE[0]}' _fzf_preview {}" \
| --preview-window=70% | readarray -t PICKS
|
| This is the whole UI. Just give it a list of things to search
| through, a prompt, and a command for previewing the thing and fzf
| handles literally all the rest of the UI for you.
| ripley12 wrote:
| If you have trouble running this, try updating fzf. TIL that my
| package manager's version of fzf is 4 years old, and that did not
| play nicely with some of the features used by Sysz.
| jabo wrote:
| Off-topic, but TIL about Unlicense License from this project's
| license. Was wondering how it differed from MIT and found this
| interesting thread:
| https://softwareengineering.stackexchange.com/questions/1471...
| freedomben wrote:
| Can anyone compare/contrast fzf and pick[1]? I use pick for all
| sorts of things, but especially as a replacement in vim for
| CtrlP. Wondering if I'm missing out on something :-)
|
| [1] https://github.com/mptre/pick
| seumars wrote:
| I love fzf but somehow I can never find a way to naturally make
| it a part of my workflow.
| petepete wrote:
| My biggest tip is to use the '**' shortcut from bash/zsh. My
| most frequent use case is for running tests, I can type:
| $ be rspec spec/**{tab}
|
| Fzf will open inline, select the file(s) you want and run them
| (like this https://asciinema.org/a/mYTmT908gvVxZTMAsfPxltULx)
|
| To get this to work I had to add this line to my .zshrc
|
| source /usr/share/zsh/site-functions/fzf
| tcoff91 wrote:
| The zag ctrl-r integration for fuzzy searching terminal history
| is amazing. Also you can do * and hit tab and use fzf to grab a
| file to use as a command line argument.
|
| Fzf is wonderful.
| flitzofolov wrote:
| Looks like a useful tool, thanks for sharing!
| bloopernova wrote:
| I'm continually impressed at how many uses fzf has. Yet I still
| feel like we're only scratching the surface of its utility.
| ducktective wrote:
| Did you know we can make unix tools (like jq) interactive (lik
| a REPL) using fzf?
|
| https://news.ycombinator.com/item?id=28577337
|
| Checkout Daniel's other scripts:
| https://github.com/DanielFGray/fzf-scripts
| vcdimension wrote:
| I use it for browsing documentation and code files, e.g. to
| browse syscall manpages:
|
| apropos -s 2 '.*' | fzf --height=100% --preview-
| window=down:wrap --preview='man -s 2 {1}'
| --bind='alt-v:execute(man -s 2 {1}),enter:execute(man -s 2
| {1})'
|
| You can also use it with rlwrap for browsing commandline
| history of arbitrary REPLs (https://github.com/hanslub42/rlwrap
| /blob/fb60c9aa7579d6b68f2...)
| whalesalad wrote:
| I have not heard of fzf - but anything that makes cli
| interactions with systemd is welcome by me. I love it as a tool -
| but it is kinda verbose with cli args.
| dr_kiszonka wrote:
| Off-topic: how do you call a prompt that looks like the one in
| the video? I'd like to have one in my fish terminal.
|
| (I tried installing an oh-my-fish theme with such a prompt, but
| it required Powerline fonts, which I can't get to work.)
| eliaspro wrote:
| Why does it use "sudo" in the first place when systemd uses
| PolicyKit for proper fine-grained/action-specific privilege
| acquisition out-of-the-box?
| quasarj wrote:
| Wait, does that mean I'm supposed to use systemctl without
| sudo, and just type my password when it prompts me?
___________________________________________________________________
(page generated 2021-09-18 23:00 UTC)