Showing posts with label shell. Show all posts
Showing posts with label shell. Show all posts

Tuesday, February 9, 2016

Clive's Ink screenshot

We'll write about Ink in the future. It's the Clive UIMS, written in Go (as all other Clive apps) and using a viewer in HTML5/javascript so the browser is the terminal device.

IX is the Clive shell (a descendant of Acme, Omero, and O/live) and, using Ink,
it can do nice things, eg., click 3 on ",~*.go" and it finds and loads all Go files under ".".
The "command language" is actually a set of external commands, thanks to using named channels as the standard I/O mechanism. A new "ink" standard output channel is along "in", "out", and "err", and let's commands output their user interfaces.
All Ink controls can be replicated in one or more web pages, which is also nice.

This is a screenshot of our development version of IX with a few commands running.



Friday, May 22, 2015

When "cd" has no arguments

In a previous post I wrote about commands and channels in Clive. Since then, things have evolved a bit I think it's worth a post.

The cd command, to change the current directory, no longer has a file name argument. Instead, it receives the directory entry to bet set as the new dot from the standard input, like everybody else does to operate on files!. That is:

        /tmp | cd

changes dot to /tmp.

As it can be seen, the first component of the pipe is not a command, but a file name. The Clive shell, Ql, is departing even more from the venerable UNIX sh. Ql commands correspond to streams as explained in the previous post. Since I wrote that post, Ql evolved as well.

Pipe-lines in Ql can be as simple as a set of file names (that is, pairs of a UNIX-like file name and predicate to find files of interest).  One example, list go source files:
       % ,~*.go
        Q/Q.go
        bltin.go
        lex.go
        nd.go
        ql/ql.go
        ql.go
        ql_test.go
        ...

(empty name, which defaults to ".", and ~*.go as predicate to locate Go files).

Further commands may be added to pipe-lines to process the directory entries found, like in the first example, or in this one:
        % ,~*.go | pf -l
        --rw-r--r--   2.1k  /zx/sys/src/clive/app/ql/Q/Q.go
        --rw-r--r--   6.3k  /zx/sys/src/clive/app/ql/bltin.go
        ...

For those cases when we really want to execute a command that takes no files as input we can just pipe nothing, so Ql does not assumes that the first series of names select files:

        % |date
        Fri May 22 19:31:06 CEST 2015

Doing a recursive grep is now delightful:
        % ,~*go |> gr '"Q"'
        Q/Q.go:27: os.Args[0] = "Q"

This used "|>" instead of "|" to ask Ql to retrieve file data and not just directory entries.

More on Ql soon.