Live data from Hacker News

CLI: Improved

remysharp.com

161–170 of 280 posts

Re: CLI: Improved

#161

I was wondering if any of you use alternatives or hacks for the cd command? I've been testing out a couple of different ones, like xd, fcd, wcd and pushd/popd, but I'm not quite sure which I should commit to or if there are better ways :)

Thanks guys. This is great stuff :)

Re: CLI: Improved

#162
post #146

Earlier quoted context omitted.

I'm actually a fan of Powershell, but unix people take it as a personal insult if you try and tell them their 70s-era tooling is inferior in some way to something designed with 30 years of hindsight.

Used PowerShell to code a small script and simply making md5 of a string is enough to make you feel nuts. The UNIX style. echo -n 'string' | md5 Compared to that obvious command, this is utter madness. You can't write a single thing without googling. $string = "string" $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider $utf8 = new-object -TypeName System.Text.UTF8Encoding $hash = [Syste…

Of course, because someone wrote a md5 executable for you to call.

You can do the same on PowerShell and write a pipeline just the same way.

Re: CLI: Improved

#163
post #14

"I'm not sure many web developers can get away without visiting the command line." IIS has significant market share. I'll bet most web developers who deploy on it get away without having to use the command line interface very often if at all. https://news.netcraft.com/archives/2018/08/24/august-2018-we...

I have co-workers who work on a big intranet web application that runs on IIS, and they never touch it. They recently finally switched to git for source control, and they want to do everything via GUI. I've tried to show them how some things are just easier/better from the command line, but if something isn't doable via GUI, they won't do it. One of them keeps committing line endings differently than everyone else, a…

I only use git on the CLI to fix the typical git blowups.

It is so much better just to use standard IDE workflows.

Re: CLI: Improved

#164
post #73
post #29

Is anyone else impressed with the quality (and speed!) of some of the tools written in Rust? I'm an avid user of fd and bat, the former being ridiculously fast. Often I find something on github, I'm impressed by the quality of the documentation, features, UI etc, then lo and behold it's written in Rust. Another one potentially for this list is tokei[1] I was trying to count the code in our repos at work and used the…

I had a case where tar was too slow for my needs. Rust did let me cobble the right syscalls and threads together to make it more HDD-friendly and faster while forcing me to handle all the gritty filesystem error cases from the start. Lo and behold, about 4 times faster on an idle system and orders of magnitude faster on a busy system. It just would not have been possible to do it by combining shell utilities and too…

That's the thing with Rust, it makes you work hard right from the start to make everything right, but when you have something working it's usually fast, too.

Re: CLI: Improved

#165
post #106
post #94

Earlier quoted context omitted.

A more generous interpretation might be that Rust has sparked a CLI renaissance, since it lets developers write CLIs that have that satisfying zip that previously was only possible in C. None of PHP, Ruby or Java is responsive enough for a good CLI tool (also, static compilation is a must for wide deployment).

Not to mention you get a language that is enjoyable but also compiles to native code. My first Rust project was a Haml parser and I created a CLI for it too that is similar to the Ruby version. It is nice being able to ship the 8Mb executable and not have to worry about users having the right runtime.

Also don't forget Cargo. It makes it so much easier to work with than installing C/C++ dependencies.

Re: CLI: Improved

#166
Is anybody here aware of any TUI/CLI tools that bring UX patterns/ideas from other programs to the terminal?

Examples:

- bash/zsh/fish bring suggestions/autocompletion

- fzf brings fuzzily-matching selections to the terminal,

- https://github.com/ericfreese/rat brings the idea of "widgets" or "layouts",

- https://github.com/mrnugget/fzz brings "preview as you type"

I'm looking for more patterns like that, mainly to explore how to make them work in the terminal and see whether that actually has an impact on everyday actions people perform in the terminal many times per day.

The goal is not to save time, but to reduce mental friction.

Re: CLI: Improved

#167
post #146

Earlier quoted context omitted.

I'm actually a fan of Powershell, but unix people take it as a personal insult if you try and tell them their 70s-era tooling is inferior in some way to something designed with 30 years of hindsight.

Used PowerShell to code a small script and simply making md5 of a string is enough to make you feel nuts. The UNIX style. echo -n 'string' | md5 Compared to that obvious command, this is utter madness. You can't write a single thing without googling. $string = "string" $md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider $utf8 = new-object -TypeName System.Text.UTF8Encoding $hash = [Syste…

A while ago I was trying to copy a bunch of files and couldn't believe the powershell abominations I found: https://techblog.dorogin.com/powershell-how-to-recursively-c...

    $exclude = @("main.js")
    $excludeMatch = @("app")
    Get-ChildItem -Path $from -Recurse -Exclude $exclude | 
              where { $excludeMatch -eq $null -or     $_.FullName.Replace($from, "") -notmatch $excludeMatch } |
              Copy-Item -Destination {
                if ($_.PSIsContainer) {
                  Join-Path $to         $_.Parent.FullName.Substring($from.length)
                } else {
                  Join-Path $to     $_.FullName.Substring($from.length)
                }
               } -Force -Exclude $exclude
All to do:

    find sourceFolder \! -path */app/* | xargs cp -t destFolder
Screwed up the formatting a bit in the first example. I'm not positive the second works perfectly but I know which one I'd rather debug.

Re: CLI: Improved

#168
I like these kinds of articles, but it's rare I need that many CLI tools on my MacBook.

I interact with hundreds of servers on a day-to-day basis, and I don't want to go around installing random tools on my servers. But I guess it's an idea for some tools to add to my Ansible server provisioning script :-)

Re: CLI: Improved

#169
post #62

Earlier quoted context omitted.

"One thing" has never been very well defined - basically every common Linux shell tool could be said to do more than one thing. GNU `grep` supports four different pattern styles (fixed strings, basic regex, extended regex and Perl regex), has lots of options for output formatting (counting, line numbers, whether to display file names, etc.) and has a bunch of rarely-used (but useful!) options for various corner cases…

The thing I would like to see with grep is to have it optionally give me a 0 return code if it doesn't find anything. I know why the authors chose to use a non-zero return code as the default, but when I'm using grep deep in a pipeline and doing my own checking of the results to see if nothing was found, I don't need grep bombing out the whole pipeline with a non-zero return code. The alternative of being forced to u…

Would grep -c work for your use-case?

Re: CLI: Improved

#170

> There is a weird bug in Mac Sierra that can be overcome by running htop as root I don't think this was a bug; I think the issue was that htop uses needed something in task_for_pid that required root.

Oh this was definitely a bug already, and a nasty one at that, as it froze the whole computer in a few minutes while the kernel was racing against itself and starving for some resource (which didn't happen while being run as root). It was fixed in macOS 10.13.4 / htop 2.2.0

https://github.com/hishamhm/htop/commit/b2771218

https://github.com/hishamhm/htop/issues/682

Post reply on HN