A good opportunity to remind everyone that we finally inboxed curl into Windows 10, so this works (with color output) from a stock Windows command prompt. Better late than never, I hope.
No need for that. You can do this: (Invoke-WebRequest -Uri wttr.in).content from Powershell. Why not use the happy path?
Curl Wttr.in
121–128 of 128 posts
Re: Curl Wttr.in
#122Earlier quoted context omitted.
Because it's the native Windows answer. There's no need to make Windows look like Unix. It's great (really!) the way it was designed.
Do you feel like you are typing a lot more for simple things like this?
Invoke-WebRequest is just iwr
Re: Curl Wttr.in
#123Earlier quoted context omitted.
It's case insensitive and there are short aliases for commands. I live in Linux, but used it way back when. It's an object oriented shell that is kind of awesome and intuitive. Bash is great and you can get shit done, but i don't think it's as user friendly as powershell.
Honestly PS feels like yet another cryptic language with irregular/nih naming of functions and arguments (like AHK which is great, but invented its own megacryptic irrational language instead of taking something generic, and now you have to google every damn thing). If I programmed for PS, then okay, but seriously, Invoke-Rest-?Method, -Uri/Url, .content — how much semantics do you learn until you give up? I’d better…
Because curl is consistent?
> urn:isbn:0451450523
Curl can't do whatever this is either?
Re: Curl Wttr.in
#124Earlier quoted context omitted.
Honestly PS feels like yet another cryptic language with irregular/nih naming of functions and arguments (like AHK which is great, but invented its own megacryptic irrational language instead of taking something generic, and now you have to google every damn thing). If I programmed for PS, then okay, but seriously, Invoke-Rest-?Method, -Uri/Url, .content — how much semantics do you learn until you give up? I’d better…
> my console rather than this Invoke-WhatEver thing, because at least it seems programming language-y and names are consistent with all other web software. Because curl is consistent? > urn:isbn:0451450523 Curl can't do whatever this is either?
>Curl can't do whatever this is either?
Right. This is a valid URI, which Invoke-RestMethod uses as a parameter name (-Uri) and which is a unique id for a resource and not its location (it could be, but not in this particular case). They should not have call that argument “URI”, if what they actually do is fetching from a URL.
Re: Curl Wttr.in
#125Earlier quoted context omitted.
Also very useful: curl ifconfig.co (shows your public ip)
I just use an alias myip is aliased to `dig +short myip.opendns.com @resolver1.opendns.com'
Re: Curl Wttr.in
#126Re: Curl Wttr.in
#127This is one of those services that I love when I find them, use extensively for the next 30 minutes and forget about. But I keep coming back to it! I even spent a time to make a simple function in my shell to cut off the output after today and accept a location name w () { curl -s "wttr.in/$1?M1q" | head -17 } and then I can just do w london to get the weather for London today. But, like most of the functions/aliases…
Just add `F` to the options, and you don't need `| head -17` then
EDIT: I just realised that "they" is actually you!
Re: Curl Wttr.in
#128Earlier quoted context omitted.
You could do something like this w () { curl -s "wttr.in/${*// /+}" } to make it work with places that have spaces in their name. E.g. w new york
Just use IFS for this w() { ( IFS=+; curl wttr.in/"$*";); }