News for hackers. Stuff that matters.
Re:Easily handle CLI operation via Python instead of regular... by joseph8th on Saturday February 12, 2022 @01:35PM (#30315057)
And then there's `xonsh`, "The unholy union of bash and Python."[0]

Which I've been using as my daily driver for a few years, and absolutely swear by it.

https://xon.sh

Re:Easily handle CLI operation via Python instead of regular... by pedrovhb on Saturday February 12, 2022 @01:55PM (#30315237)
I've been daily driving xonsh for a couple of years too. It _sounds_ like a terrible idea for reasons you can't quite put your finger on, but other than a minor annoyance every now and then, it's been great.

I especially like iterating over files as Path objects with the simple syntax

    for f in p`.\*\.jpg`:
        if f.isdir():
            foo = $(echo @(f.absolute()))
Re:Easily handle CLI operation via Python instead of regular... by suifbwish on Saturday February 12, 2022 @03:16PM (#30315960)
What sorcery is this?! Object oriented bash? Incredible.
Re:Easily handle CLI operation via Python instead of regular... by abnry on Saturday February 12, 2022 @04:27PM (#30316678)
PowerShell has entered the chat.
Re:Easily handle CLI operation via Python instead of regular... by meanmrmustard92 on Sunday February 13, 2022 @01:53AM (#30319845)
Powershell doesn't simply enter the chat. Powershell enters-its-username-and-password-and-hits-enter the chat.

[I'm usually a fan of informative command names, but surely there's a happy medium]

Re:Easily handle CLI operation via Python instead of regular... by joseph8th on Sunday February 13, 2022 @11:53AM (#30323135)
Really it's just a souped-up Python interactive shell. When you give it bash commands, it forks to bash. When you give it python it evaluates like a REPL
Re:Easily handle CLI operation via Python instead of regular... by seanw444 on Saturday February 12, 2022 @01:40PM (#30315094)
What in the world... that's certainly interesting.
Re:Easily handle CLI operation via Python instead of regular... by c0npr on Saturday February 12, 2022 @09:38PM (#30318589)
agreed, but if I am learning a new syntax anyways I will go for ansible.
Re:Easily handle CLI operation via Python instead of regular... by ginko on Sunday February 13, 2022 @05:06AM (#30320664)
Care to explain? Xonsh is a python shell. From a cursory look at the very corporate Ansible website and wikipedia it's

"an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code"

Whatever that means. They seem to do very different things as far as I can tell.

Re:Easily handle CLI operation via Python instead of regular... by joseph8th on Sunday February 13, 2022 @11:50AM (#30323110)
No new syntax, unless you want to write scripts in xonsh, or mix bash and Python in the same command. There's rarely any reason to. 99/100 times I just write pure bash or pure python