Live data from Hacker News

Command line tools for productive programmers

earthly.dev

51–60 of 143 posts

Re: Command line tools for productive programmers

#51
post #36

I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ entr lets you watch files and re-run a command any time they change. Whenever I'm working on a script, or go tests, or whatever test-like thing I'm doing that's not in its own bloated test harness, I reach for entr. Great software, does what it's supposed to every time.

You can do it with inotify too tho , no ?

Great project tho !

Re: Command line tools for productive programmers

#52
post #36

I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ entr lets you watch files and re-run a command any time they change. Whenever I'm working on a script, or go tests, or whatever test-like thing I'm doing that's not in its own bloated test harness, I reach for entr. Great software, does what it's supposed to every time.

I used to use entr extensively for Sketch plugin development (the vector editing tool by Bohemian Coding). However the app used to crash randomly and I felt my plugin was causing it. I spent an inordinate amount of time trying to debug it, replacing libraries, changing code and so on. Thankfully I noticed at some point that the app was behaving well for long durations of time when I started it without entr. I got rid of it from my toolchain and things have been well ever since.

I still don't know the root cause, but now I know one more place to look for heisenbugs.

Re: Command line tools for productive programmers

#53
post #39
post #20

Earlier quoted context omitted.

Does it contain emacs? That would be nice.

What's wrong with dired mode? Ok, you'll get each directory in its own buffer. But, thinking of that, it shouldn't be to hard to make dired mode recurse into subdirectories inside the same buffer. (And fold/unfold like orgmode does. ;-)

It's a single variable setting now:

https://www.manueluberti.eu/emacs/2021/07/14/dired/

Re: Command line tools for productive programmers

#54
post #8

For his usecase of funky i use ~/.bash_aliases, that way i can easily share them between machines. Eg to quickly add a new one: alias als="nvim $HOME/.bash_aliases && source $HOME/.bash_aliases" Be careful with quoting though, got myself into a situation where every new terminal asked for the root password. Shellcheck found the reason quickly. (edit) Another benefit is that those aliases abstract over differences of…

I used to alias .. etc., but then found that Fish shell has helpful commands and behaviours for directory navigation built in:

> Note that the shell will attempt to change directory without requiring cd if the name of a directory is provided (starting with ., / or ~, or ending with /).

> https://fishshell.com/docs/current/cmds/cd.html

So these all work without the cd by default with Fish:

../

../../

~

~/path/to/folder

cdh is also very useful. It shows a history of recent directories with a keyed prompt to jump to a directory.

https://fishshell.com/docs/current/cmds/cdh.html

Re: Command line tools for productive programmers

#55

This is productivity porn for programmers. While obviously these tools are deep and powerful, there is also a learning curve and experimenting wether you can adapt your workflow to them or vice versa. Next year we will have another 5 shiny command line tools, and so on. My point being: only replace your weapons of choice once you are confident you are using them to their full potential and you identify needs that the…

Your main point doesn't do alternative tools justice. It is totally fine to use a newer tool as a novice so you are learning something that will serve you better in the long run, even if you aren't an expert in some other tool from the start

Re: Command line tools for productive programmers

#56
Something that i use often,

There are those edge cases where i want to edit and get something out of a unix pipe based oneliner i made however in certain scenarios i find myself having to write complicated code for just a one or two line edits to the piped output

In those i recommend using vipe (its a part of moreutils) it lets you put in your favourite text editor in between your unix pipes , so you can edit things manually from the stdout midway a pipe and let the rest of the pipe take it from there.

Its quite handy , this way i can sometimes use vim’s macro functionality inside my pipe oneliner scripts for when its not worth it to code it with sed,cut,awk or grep.

Re: Command line tools for productive programmers

#57
post #45

Earlier quoted context omitted.

Exactly, this is the opposite of the unix way of doing things. Do only one thing and well, be nimble.

> this is the opposite of the unix way of doing things Which makes sense, this is an article for people on Apple hardware (judging by the installation instructions), so no interest in keeping things "the unix way of doing things"

I have no dog in this fight (I use both Linux and macOS as daily drivers) but it could be argued that macOS has more of a claim to be Unix than Linux since the foundation of macOS comes from NeXTSTEP and FreeBSD whose codebases both ultimately descend from the original Bell Labs Unix, whereas Linux started life completely independently.

I'd argue that Linux is more Unixy than macOS in terms of philosophy though, I remember reading that Dennis Ritchie considered Linux as much of a Unix as the other offerings on the market at the time which were the BSDs and commercial Unix variants; his opinion is obviously worth thousands of mine!

Re: Command line tools for productive programmers

#59
post #36

I can't sing the praises enough of entr. Just check out its man page: http://eradman.com/entrproject/ entr lets you watch files and re-run a command any time they change. Whenever I'm working on a script, or go tests, or whatever test-like thing I'm doing that's not in its own bloated test harness, I reach for entr. Great software, does what it's supposed to every time.

I didn't know of entr, or inotify at the time. Years ago, I wrote a script that did mostly that, but I've found myself to instead more often use a different script to rerun things based on manually triggered global hotkeys. It scratches a different itch, but in case you want to check it out: https://github.com/swarminglogic/shell-scripts/blob/master/r...

In short, you set up a global hotkey to trigger the rerun of a "key"-ed command. Then you can quickly run a command, which can be rerun with that hotkey.

So, a global hotkey set up for `runrerun -r foo`

Then in a terminal you can use `runrerun -b foo -- `.

It is a bit over-engineered with multiple sessions, different kill signals for restarts, etc. But that's the gist of it.

Re: Command line tools for productive programmers

#60
I would suggest https://rubygems.org/gems/ruby-each-line-2

e.g.

    ps -A | grep ruby | grep fsevent | ruby-each-line "puts l.split.first" | xargs kill -9
    cat c | ruby-each-line "puts l.split.first[0..-2]" >> .env.development
    pbpaste | ruby-each-line "puts l.split.last" | ruby-all-lines "puts lines.map(&:strip).join(',')"
Post reply on HN