News for hackers. Stuff that matters.
Re:—-libcurl by xnorswap on Monday January 29, 2024 @10:09AM (#39177087)
What you're looking for exists, it's powershell.

    Invoke-WebRequest -Method 'Get' -Uri 'https://example.com'
And the response is a typed object:

That you can pipe properly by piping objects not strings, e.g. :

    Invoke-WebRequest -Method 'Get' -Uri 'https://example.com' | Select-Object -ExpandProperty Headers
Outputs:

    Key            Value
    ---            -----
    Age            438810
    Vary           Accept-Encoding
    X-Cache        HIT
    Content-Length 1256
    Cache-Control  max-age=604800
    Content-Type   text/html; charset=UTF-8
    Date           Mon, 29 Jan 2024 15:08:42 GMT
    Expires        Mon, 05 Feb 2024 15:08:42 GMT
    ETag           "3147526947+ident"
    Last-Modified  Thu, 17 Oct 2019 07:18:26 GMT
    Server         ECS (nyb/1D15)
Re:—-libcurl by sph on Monday January 29, 2024 @11:07AM (#39177905)
Can you copy and paste that snippet as is into a C# program? This is what I meant.

Powershell has a high level object model but it doesn't make Windows itself anymore programmable and interactive, as a whole than zsh does for Linux. It is no Lisp Machine.

Re:—-libcurl by freedomben on Monday January 29, 2024 @10:26AM (#39177318)
Yes yes, power shell is powerful and really good. I wanted to hate it because it seems too verbose and I don't like the mix of capitals and hashes in names. but the APIs they make available from .Net are pretty phenomenal. Extreme verbosity aside, done day I'm have to seriously learn it
Re:—-libcurl by actionfromafar on Monday January 29, 2024 @10:55AM (#39177723)
Can't hate it, but I can't love it either. I wish some other more "normal" languages (Ruby? Python?) had a better "shell" story and dotnet integration.
Re:—-libcurl by int_19h on Monday January 29, 2024 @10:06PM (#39185951)
For Python, https://sh.readthedocs.io/ is very nice, but unfortunately no Windows support.
Re:—-libcurl by freedomben on Tuesday January 30, 2024 @02:44AM (#39187386)
For so long I have dreamed of a ruby-like shell language. At one point I even built a prototype that was a ruby DSL, but I found myself continually having to implement functions and it never seemed to get to a point where I could use it all day and not run into missing functionality that I had to add. Some day I'll return to it, but it will have to be a day when I don't have a real job :-D
Re:—-libcurl by shirogane86x on Monday January 29, 2024 @02:19PM (#39181049)
For simple interactive usage aliases go a long way, and with tab completion it gets really fast to write. For example, Invoke-WebRequest is iwr, Select-Object I think is just select. Some others are ForEach-Object which is %, and Where-Object can be ? Or where. Also, since PowerShell is case insensitive, you don't really need to use all those capitals - the worst you'll get is a warning from your editor, if it has PowerShell integration (around 99% sure about this)
Re:—-libcurl by xnorswap on Tuesday January 30, 2024 @03:39AM (#39187735)
It also has tab completion of parameters, so you can tab complete not just commands but things like -ExpandProperty too
Re:—-libcurl by shirogane86x on Tuesday January 30, 2024 @05:30PM (#39196827)
I think you don't even need to type out the whole option, just the first few letters most of the time? I haven't used PowerShell in a bit, but I think if you have a command with a -Force option, but just type -f, it will go through as -Force, if and only if the command doesn't have any other options starting in f