Slashdot Mirror


Imagining the CLI For the Modern Machine

scc writes "TermKit is a re-think of the storied Unix terminal, where human views, input and data pipes are separated. Output viewers render any kind of data usefully. It may not be a new idea, but it's certainly a new take on it." I know you are quite comfortable in your shell of old, but this sort of thing sure gets my juices going. The best of both worlds.

3 of 317 comments (clear)

  1. Re:cat crap by dzfoo · · Score: 4, Insightful

    Also, the purpose of "cat" is to concatenate files, not display; it just happens to output to STDOUT so that it can be used as part of an efficient tool chain workflow. By consequence, using "cat" on a single file will output its contents to the terminal. This is a useful side-effect, but not its main function.

              -dZ.

    --
    Carol vs. Ghost
    ...Can you save Christmas?
  2. Re:Everything is an INCOMPATIBLE object by mangu · · Score: 5, Insightful

    Objects can be rendered on the terminal as well

    Rendering them is different from the object itself.

    Even though the pipeline streams objects, the output from the last command of a pipeline is rendered on the terminal

    Again, rendering is not the object. I can have a list of different operation I need to do, passing things from one program to the other. If all I can see is the rendering of the last command I cannot see what is actually being passed from one command to the next one.

    Developing is incremental. The power of Unix is that this simple fact is everywhere. I need to see all the processes:

    ps aux

    Which ones are owned by boris?

    ps aux | egrep '^boris'

    What are the process numbers and creation time?

    ps aux | egrep '^boris' | awk '{print $2, $9}'

    OK, sort that by process number

    ps aux | egrep '^boris' | awk '{print $2, $9}' | sort -n

    In Unix I build up my commands step by step. What I learn in one place can be used somewhere else. The same sort command I use for process numbers is the one I use for my phone book.

    If I can't remember exactly how awk works I can test it by typing

    echo "1 2 3 4 5 6 7 8 9 10 11" | awk '{print $2, $9}'

    It would not work if 'echo' showed a representation on the terminal that is not exactly the same thing it pipes to 'awk'

    I'll grant that PowerShell is a more natural fit for Windows given that so much of the OS and applications are exposed as objects.

    That's a shortcoming of windows, not an advantage of powershell.

  3. Re:Close, but no Cigar... by waveclaw · · Score: 4, Insightful

    . Instead of the UNIX 'everything is a file' philosophy, it says 'everything is an object', and it's pretty cool.

    It is pointing out the obvious that a file is kind of object, with a certain defined behavior, strong namespaces and associated methods?

    Systems like Plan9, where everything literally is a file make the painfully obvious. The only changes would be to make file properties be just more files that appear to live bellow the filename as if it were a directory and get rid of completely foreign namespaces like the network interfaces.

    There is some extra syntatic sugar with object systems. The 'object' systems use dot delimited dereferencing for system enforced sub-classing - runtime resolution of the thingy being talked about. The file system's path separators are only meaningful on the filesystem meta-level for object...er...file isolation. Otherwise we are dithering over path separators to namespaces: /path/to/thingy instead of container.subelement.thingy.

    Of course, PowerShell has the advantage of an actual design and uniform implementation. Even the traditional Unix utilities produce completely unique output formats that often require regular expressions to pull out meaningful data or at least massage the pipe. This is a possible consequence of unregulated organic growth.

    Now, the author of TermKit has a valid point in his article on the sofware's design: not enough file handles are used by traditional Unix utilities. STDOUT and STDERR are both used to produce human-readable and machine-readable output. Instead make STDOUT,STDERR (FD 1 and FD 2) machine-only and FD 3 and 4 be used for human-consumable output. This could be much more flexible. (Of course, like most standards, nobody would have used it in the sake of rolling the next great thing.)

    But this highlights that trivially parsable output combined with pure file semantics gives you the benefits pure 'object' environments like Powershell gives to users. So it appears the inconsistency between terminal applications is the real issue, not some mythical object-ness that Powershell proponents claim files don't have. And TermKit's plugins / adapters "fix" that.

    After all, what are programing languages but syntactic sugar in our heads, mere mental layers on top of high and low voltages running through some hardware?

    --

    "You cannot have a General Will unless you have shared experiences. You cannot be fair to people you don't know."