Get the latest tech news

"Rules" that terminal programs follow


"Rules" that terminal programs follow

As an example of how this works in an interactive program: here’s the code in prompt-toolkit(the library that iPython uses for handling input) that aborts a search when you press Ctrl-C. I actually thought that this one was a “Law of Terminal Physics” until very recently because I’ve basically never seen it broken, but you can see that it’s just something that each individual input library has to implement in the links above. Both of those programs will also format their output differently when writing to the terminal: ls will organize files into columns, and ripgrep will group matches with headings.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Rules

Rules

Photo of terminal programs

terminal programs

Related news:

News photo

Hong Kong police consider using drones for patrols as rules are reviewed

News photo

Tesla lobbied UK to strengthen rules on carbon emissions from cars and lorries | Tesla

News photo

The Rules of Programming (2023)