4 ms·
Can I get a parseable ls? Can I get explicit output-as-json flags for all reasonable commands like ps, lsblk, ls, find, grep, etc? Can I get a database of com
by AtlasBarfed 5y ago
Can I get a parseable ls?
Can I get explicit output-as-json flags for all reasonable commands like ps, lsblk, ls, find, grep, etc?
Can I get a database of commands better than history that shows when they were run and error codes that resulted AND THE OUTPUT, and if it completed for multithreaded/background/etc.
The history-as-database is ultra-important for doing cli multiprocessing/async. Fire off command, and then you can get the output from the database to pipe to another command.
Can I get a reasonable metashell standard across all terminal apps for doing a lot of what .profile does but isn't tied to a specific file on a specific machine?
- AtlasBarfed 5y agoI'll expand this more. What I really want and have already partially built for some things is a very powerful metashell for delivering commands across multiple machines and composing them. As referenced above, a central database of command, exec status, output, and where executed would be central to this. THe ability to define sets of machines as clusters and running and returning commands from those in parallel is also essential The ability to pull, push, edit files remotely... The ability to store access methods to deliver and return the commands: be it ssh, teleport, (ugh) telnet, kubectl, docker run, aws ssm, etc. I've written about 20% of that for my current job managing various nosql database clusters. But it is very much ugly and something I'm very far from being happy with, even after about two rewrites
- nathanmcrae 5y agoYou may have already seen it but jc (https://kellyjonbrazil.github.io/jc/ https://kellyjonbrazil.github.io/jc/) helps with the first two: $ jc ls -l | jq [ { "filename": "bin", "flags": "drwxr-xr-x", "links": 1, "owner": "nathanmcrae", "group": "nathanmcrae", "size": 4096, "date": "Jun 28 15:15" }, { "filename": "pkg", "flags": "drwxr-xr-x", "links": 1, "owner": "nathanmcrae", "group": "nathanmcrae", "size": 4096, "date": "Jun 28 15:15" } ]
- enriquto 5y agoThis is horrifying! Why would anybody want that?
- AtlasBarfed 5y ago... because you want something that jq can reliably parse from the filesystem listing output?
- partdavid 5y agoI think Powershell gets you part of the way down this road, at least on some of these features, without requiring you to figure out everything/adopt everything first. Out of the box it works fine as a Unix shell (you know, invokes commands, pipes output, etc.). Everything's not rosy-hunky-dory, each of these have limitations but: > Can I get a parseable ls? > Can I get explicit output-as-json flags for all reasonable commands like ps, lsblk, ls, find, grep, etc? Better than "parseable", you get commands which just return the structured data, for ls (gci), and many other "foundation" commands like ps (gps), etc. I didn't actually think about a structured grep but maybe you wouldn't use it as much with stuff like ConvertFrom-Csv (so you have structured data to select rather than strings to "grep"). Anything you can get JSON or YAML or CSV output from you can just turn into structured data (ConvertFrom-Json) and handle in the same way. Any native Powershell implementation of anything will emit complex data in the same way (e.g. AWS's Powershell tools). > Can I get a database of commands better than history that shows when they were run and error codes that resulted AND THE OUTPUT, and if it completed for multithreaded/background/etc. Background job handling is a lot better with Powershell than with bash and allows you to address background jobs by id, get metadata about them and the output, with rcjb (Receive-Job). Your job list is manipulatable with the same Powershell tools as everything else, so you can sort and select easily on things like status or the host on which it executed. > Can I get a reasonable metashell standard across all terminal apps for doing a lot of what .profile does but isn't tied to a specific file on a specific machine? It's an interesting idea, hard for me to conceive. Do you mean shell and command configurations that go along with your shell session to other machines? Powershell remoting allows you to establish a session and then mix local and remote commands while retaining your setup and environment, it may partly help. The gotcha: you need to enable the SSH configuration which allows this and (of course) have Powershell installed on the target systems.