4 ms·
I may be a little cynical but when I read the words "modern utilities" my first associations are: too much output coloring (typically implemented by relying on
by PhilipRoman 4y ago
I may be a little cynical but when I read the words "modern utilities" my first associations are: too much output coloring (typically implemented by relying on several libraries), no proper documentation, output formats that are not machine-friendly, overuse of TUI interfaces where simple writing to stdout would integrate better with the rest of the world, complicated configuration files (typically requiring even more libraries), etc.
Honestly - the only thing i really miss among the default utilities is the hypothetical command "sortby" (and maybe it's cousin "uniqby") which could be used, for example, like this:
... | sortby cut -d: -f2 | ...
Or
... | sortby tr [:upper:] [:lower:] | ...
I know there are ways to implement practically any type of sorting by using flags to sort and a little bit of {pre,post}processing but having a "sortby" would be so much more elegant. You would have the full power of awk/sed/whatever integrated seamlessly with "sort".
- readingnews 4y ago>> output formats that are not machine-friendly As a long time unix sysadmin, this is the thing that always rears its ugly head.
- pdimitar 4y ago> output formats that are not machine-friendly Not a new problem. It was always like that. Not sure if you know about the `jc` tool. It converts the plain text output of a subset of UNIX commands to JSON. It's helpful, I've used it. > complicated configuration files (typically requiring even more libraries) Not sure I can stand behind the "more libraries" argument, some formats like TOML are stable and predictable and having one more system-wide library is worth it to have them accessible. On config files: if the tool allows you to specify 100% of what you need on the CLI then I usually make an alias and I'm done. I too dislike tools that mandate a config file though. I view the tool authors as not very sympathetic to their users in this case.
- PhilipRoman 4y agoYeah I shouldn't have included that bit about libraries - if there is a config file, it doesn't matter how you parse it. My preferred ways of configuring in order of preference would be: having a config.h (for a few, highly customized programs, like my terminal, browser, etc.), environment variables (has the advantage of applying to subprocesses, which can be useful for some types of programs) and flags. Aliases with flags can be lost in a lot of contexts, but you can always place wrapper scripts in PATH which just exec the real command. As a side note - the wrapper script approach is really powerful for fixing programs that you don't have the time to patch. In particular, if a TUI program doesn't clear the terminal after exiting, you can put it between "tput smcup" and "tput rmcup".
- simplotek 4y ago> I may be a little cynical but when I read the words "modern utilities" my first associations are: (...) I think this comment is too short-sighted and naive. In the end at best it's an apples-to-oranges comparison between what you personally like and are used to with a cherry-picked set of tools and what you personally don't like and have an axe to grind with a cherry-picked set of strawmen. There are plenty of decades-old tools that provide colorful TUI interfaces that don't integrate with standard tools and make them hard to reuse with UNIX tooling. There are plenty of excellent non-standard tools that are quite recent and raise the bar in UX. This is not an old-vs-new comparison. This is reads like a rant directed at strawmen. Let's face the facts: JSON is excellent as a data interchange format, and YAML is a far improvement in expressiveness over INI-type formats. Colors are important to make things human-readable, and TUI is a UX godsend in applications that involve view-heavy data presentation and ensure complex commands can be a key press away.
- abecedarius 4y ago> sortby Something like this? (But of course made more robust. I'm not really into shell scripting.) t=`mktemp sortby.XXXX` tee $t | "$@" | awk '{ key = $0; getline <"'$t'"; print key "#" $0; }' | sort -t'#' -k1 | cut -d'#' -f2- rm $t