Live data from Hacker News

New(ish) command line tools

jvns.ca

81–90 of 252 posts

Re: New(ish) command line tools

#82
post #54

I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…

Just posting this without trying it out...grep -nH gives you line numbers and full filepath context, and as another commenter said, -ve allows you to string multiple excludes, so grep -inH -ve not_this -ve nor_this -ve nor_that.

You don’t have to stack -v like that: -v inverts all the -e expressions, so this should be equivalent:

    grep -inHv -e foo -e bar -e baz

Re: New(ish) command line tools

#84

Has anyone made an installer/GNU type thing for the "common" ones like delta and rg? Could be a fun weekend project: Select what tooling you want, it will be installed using your package manager [ ] delta [ ] bat ...

Homebrew works great, even on linux. Every one of these nifty tools is available there.

asdf is another good option with most of them.

Re: New(ish) command line tools

#86

A simple trick I only figured recently is following logs with fuzzy search: tail -f /var/log/foo.log | fzf +s Or something similar for output from a dev server: make serve | fzf --ansi +s

Speaking of logs, angle-grinder is amazing: https://github.com/rcoh/angle-grinder

Re: New(ish) command line tools

#87
post #60

I’m a fan of nnn for a terminal file manager, so I’m keen to try out broot. Does anyone have other recommendations I should try? https://github.com/jarun/nnn

How does nnn compare to ranger https://github.com/ranger/ranger ?

ranger is fancier (both visually and in terms of configurability), but nnn is significantly faster in my experience. I kept putting off looking into ranger's rifle capabilities and Python scripting, but after having it crash on me a couple times - in a directory with many hundreds of files, to be fair - I tried nnn. The speed and simplicity made me switch over entirely, because it has just the right amount of features that I wanted from ranger. (Well, the one thing I kinda miss is the inline Markdown preview in ranger - shortcut `i` - but it's a minor convenience at best.)

Re: New(ish) command line tools

#88
post #83

Any terminal based solutions for Postman/Insomnia/Nightingale? I am just using curl and text files for api testing.

I found https://github.com/hoppscotch/hoppscotch recently and it's quite nice. There's also a VSCode extension that doesn't look like it's actively developed any more: https://marketplace.visualstudio.com/items?itemName=rangav.v...

Re: New(ish) command line tools

#89
post #7

Couple ones there that I’m keen to try out. bat in particular seems like such an easy win

bat is certainly a game changer. I never printed things out to the terminal - always did a `less` or a `view` - before I installed bat.

One (very) minor issue I have with it is that when the file is very small - a couple words or lines at most - then the "decorations" it prints around the content get distracting and make the content slightly harder to read. Maybe I should just write a wrapper around it that does a `wc` first and decides whether to do a `bat` or a `cat`.

Re: New(ish) command line tools

#90

I could really use a better workflow to refine grep matches. Has anyone made a tool that combines grep (regex search) with fzf (multiple positive/negative patterns)? What I really want is something like: grep pattern1 **/* | grep pattern2 | grep -v exclude_these | grep -v also_exclude The problem is this loses filenames and context lines in the output. I want to apply several positive and negative regexes, and only a…

I do things like that inside Emacs with the consult-grep command from the Consult package, combined with the Orderless matching style, Embark to collect the results in a buffer. This has several advantages over the command line:

- Interactivity: the results are updated live as you type, so you catch typos sooner and can tweak the search terms as you go.

- The buffer of search results you collect with Embark is not dead text like it would be in the terminal, instead, each line is a link to the corresponding file taking you to the line that matched.

- Wgrep lets you edit all the matching lines in place!

Packages referenced:

1. Consult: https://github.com/minad/consult/

2. Orderless: https://github.com/oantolin/orderless

3. Embark: https://github.com/oantolin/embark

4. Wgrep: http://github.com/mhayashi1120/Emacs-wgrep/raw/master/wgrep....

Post reply on HN