Re:Show HN: Sultan – Pythonic interface to your shell
by aeroxis on Monday June 12, 2017 @08:48AM
(#14536866)
Representing each row as an object works, but it ends up having us write custom objects for different result types. When you run Sultan().ls('-l'), you will get back a list of Strings, which you can freely use in Python for your specific needs (like use a Regex to fetch date/times or file size). I felt like this offers developers the best flexibility, rather than trying to customize each output (which will definitely make the codebase very confusing)
Re:Show HN: Sultan – Pythonic interface to your shell
by friendzis on Monday June 12, 2017 @01:57AM
(#14535403)
And then I remember that Windows PowerShell does (attempts to, to be fair) exactly that
Re:Show HN: Sultan – Pythonic interface to your shell
by stinos on Monday June 12, 2017 @03:24AM
(#14535630)
attempts to, to be fair
Output of ls in PS is an Array of objects (DirectoryInfo or FileInfo instances). How is that merely an attempt?
Re:Show HN: Sultan – Pythonic interface to your shell
by friendzis on Monday June 12, 2017 @09:45AM
(#14537295)
While PS-native stuff yield objects, not all pre-PS utilities/builtins are overriden or have interface for PS and output old fashioned text blob, which is not automagically parsed in any way by PS. My comment was system-level, not utility-level.
+1 for https://sultan.readthedocs.io/en/latest/sultan-examples.html...
I think it would be interesting if you could iterate on the results of "ls -l", where each row is represented by an object.