4 ms·
Looking at things like this ``` let result = try await Subprocess.run( .name("ls"), arguments: ["-la"], output: .string(limit: 4096) ) print(result
by adamnemecek 19d ago
Looking at things like this
```
let result = try await Subprocess.run(
.name("ls"),
arguments: ["-la"],
output: .string(limit: 4096)
)
print(result.standardOutput)`
```
reminds me that macOS could really use something like powershell (I know you can run powershell on macOS) where you pass around structured data, rather than the endless parsing and reparsing. This is mostly a feature of the shell but you do need some language infrastructure to accomplish it.
- drfloyd51 19d agoSo you mean the ability to run a shell from code And receive structured data back?
- adamnemecek 19d agoSomething like that yes. The endless parsing and reparsing that you need to do in the unix shells is such a pain.
- steve1977 19d agoIt's both curse and blessing. Of course it gives you ultimate freedom, but like with programming languages, I personally prefer the guardrails that a type system provides.
- adamnemecek 18d agoWe are on the same page then.
- dadoum 19d agoTo me the secret sauce behind powershell is the .NET infrastructure, which allows much more runtime introspection than the usual compiled programming languages, allowing a lot of flexibility without being too wonky. Unfortunately the Windows team seemed to not be on board with this vision, and thus it cannot achieve its full potential. The objective-c runtime may have been a good alternative here too, but I don't think Apple is encouraging its use anymore (and Objective-C is not the right language for that, neither is AppleScript imo).
- steve1977 19d agoYou can also access COM from PowerShell, which basically opens up a lot of the Windows world to it. And both .NET and COM and the object-oriented history of Windows is probably also why PowerShell will never really feel "at home" on UNIX platforms, for better or worse.
- bbkane 19d agoThey should adopt Nushell! It would be seen as very "Apple"- a brave great somewhat non interoperable user experience upgrade
- adamnemecek 19d agoI was a big fan of Nushell for some time but has the same problems as unix shells. I have this CLI tool that manages a lot of things for me (a big one is downloading and cataloging arxiv papers, it downloads them and tags them with metadata and gives each PDF a proper filename based on the author's name and publication year). I tried building this in Nushell but it became eventually so painful.
- bbkane 18d agoI'm sorry, what are the same problems you're referring to? I ended up leaving because: - it was unstable and kept changing (less of an issue now) - I still need to know bash due to its ubiquity - it was worse than python for data crunching scripts (ide tooling + my familiarity) This was several years ago so I'm curious about a more recent perspective
- adamnemecek 18d agoThere is some unstability yes. For me the larger problems were the lack of types which in practice meant that I was running into the same problems as with bash.
- bbkane 18d agoNushell does have types: https://www.nushell.sh/book/types_of_data.html https://www.nushell.sh/book/types_of_data.html
- adamnemecek 17d agoSupport for custom types is not there.