Earlier quoted context omitted.
If I had a nickel for each `cat foo.json | jq | pbcopy`, I'd be a rich man :)
That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.
macOS command-line tools you might not know about
191–200 of 454 posts
Re: macOS command-line tools you might not know about
#192Earlier quoted context omitted.
It's cool to use pbcopy and pbpaste with your phone! Copy some text on the phone, and you can pbpaste it onto the Mac command line. So cool.
It creeps me out when the clipboard is unexpectedly shared between my phone and computer. And since the feature seems to turn on randomly but not reliably when I want it to, I’d rather it just didn’t exist.
* Mac: Go to System Preferences > General > uncheck Allow Handoff.
* iPhone: Go to Settings > General > Handoff > uncheck Handoff.
Re: macOS command-line tools you might not know about
#193I use: ``` #!/usr/bin/env bash set -u title=${2:-Shell} msg=$1 osascript -e "display notification \"$1\" with title \"$title\"" ``` As `~/bin/,notify` and put it at the end of long-running commands: ``` run_this_program && ,notify "Long program is done!" ```
Re: macOS command-line tools you might not know about
#194Earlier quoted context omitted.
That's a useless use of cat. You can use `jq . foo.json | pbcopy` or `jq < foo.json | pbcopy`.
The “useless cat” meme needs to die. Everyone is aware that most commands accept a file argument, but looking up the arguments and their ordering is annoying and using cat for things like this is just fine.
Re: macOS command-line tools you might not know about
#195Earlier quoted context omitted.
It's cool to use pbcopy and pbpaste with your phone! Copy some text on the phone, and you can pbpaste it onto the Mac command line. So cool.
It creeps me out when the clipboard is unexpectedly shared between my phone and computer. And since the feature seems to turn on randomly but not reliably when I want it to, I’d rather it just didn’t exist.
Re: macOS command-line tools you might not know about
#196Earlier quoted context omitted.
In what way do you see those alternatives as superior?
They avoid an unnecessary invocation of the cat executable. Instead, they open a file descriptor and pass that. Tiny difference but there you go.
And ... ?
Re: macOS command-line tools you might not know about
#197Re: macOS command-line tools you might not know about
#198Re: macOS command-line tools you might not know about
#199And urls! I use that one in a lot of my scripts. We have a ticket-based workflow, and I can parse out the ticket number from the current git branch, and open the ticket or create a merge requests without having to do anything complicated.
Re: macOS command-line tools you might not know about
#200I use: ``` #!/usr/bin/env bash set -u title=${2:-Shell} msg=$1 osascript -e "display notification \"$1\" with title \"$title\"" ``` As `~/bin/,notify` and put it at the end of long-running commands: ``` run_this_program && ,notify "Long program is done!" ```
I can’t help but ask, why “,notify” and not just “notify”?
So I can type , and I am sure it's my program and I'm not running something else and it'll autocomplete among my list of programs.