Live data from Hacker News

Rich Command Shells

waywardmonkeys.org

91–100 of 101 posts

Re: Rich Command Shells

#91
post #61

Earlier quoted context omitted.

Exactly as you indicate, even in "classic" terminals we have features like unicode support, color, geometry reporting, mouse reporting, window title manipulation, arbitrary cursor movement, etc. All these are in widespread use today. These features could not have been implemented in a real tty, but nowadays I think it makes sense to have them. Maybe some are a little kludge-ish, but are we really arguing about their…

"Exactly as you indicate, even in "classic" terminals we have features like unicode support, color, geometry reporting, mouse reporting, window title manipulation, arbitrary cursor movement, etc." Is that true ? For instance, I am not aware that (for instance) the OSX terminal app does mouse reporting or geometry reporting. Does default xterm ?

In Terminal.app you can use the mouse to move the cursor at the command line. Since at least 10 years.

Re: Rich Command Shells

#92
post #12

If I might plug a rich command shell I'm developing: http://pigshell.com (Source at https://github.com/pigshell/pigshell ) It provides - A shell for the web. Runs in the browser, pure client-side. - File-like abstraction for URLs and other entities exposed by web APIs - Unix-like style of composing commands using pipes. - Visualization using HTML For instance, cp -r /gdrive/ /home will backup the contents of your Goo…

Interesting. Why do you think that files are good abstraction for a web shell?

Are you familiar with Plan9? Everything is a file. Everything.

Re: Rich Command Shells

#93

Earlier quoted context omitted.

> in the other corner: the complaint that sometimes, people can put carriage returns in their filenames and screw up the output of `ls -1`. With no suggestion of what would replace composed functional streams. How about functions that operate on data structures such as lists and maps? These can include generic functions that can slice and dice data structures regardless of what type of data those structures contain.…

The unix dataset already works on list and map data structures. lists: ls -1 | wc -l maps: ps -ef | grep 'tobekilled' | grep -v grep | awk '{ print $2 }' | xargs kill would unix be better if it were cwd.files.count and processes.filter{name = 'tobekilled'}.map(kill) ? maybe for the newbie who paradoxically already understands functional and object-oriented programming, I'll grant. But the 'pipe' ("this is a bucket br…

I don't have access to powershell on linux but I think the syntax would be

(ls).Count

(where ls is an alias for http://ss64.com/ps/get-childitem.html which returns .net FileInfo objects, it can also return info for registry paths)

and

ps | ?{ $_.Name -eq 'tobekilled' } | %{ $_.Kill() }

(ps an alias for http://ss64.com/ps/get-process.html returns .net Process objects)

or the equivalent of pkill

Stop-Process -Name 'tobekilled'

Re: Rich Command Shells

#94
post #41
post #21

Earlier quoted context omitted.

Except REPLs are CLIs on steroids. UNIX shells can only seem powerful for those that never had the luxury of playing with Smalltalk, Lisp, Mesa/Cedar or Oberon environments. Where you have a CLI and GUI experiences interact together to create a composable workflow experience. Where I can do function composition on my REPL over data that I just selected with my mouse on a word processor, just to give a possible exampl…

IPython already makes for a pretty good bash/zsh/etc replacement for many things. You can get a GUI using the IPython notebooks as well. While I haven't made the switch completely yet, I always keep an IPython session around in an extra tab, since it is very often just much simpler to do something there than in bash.

>I always keep an IPython session around in an extra tab

By "tab" you mean tab in your web browser; do you not? (I ask because there are non-web-based IPython thingies.)

Re: Rich Command Shells

#95
post #41

Earlier quoted context omitted.

IPython already makes for a pretty good bash/zsh/etc replacement for many things. You can get a GUI using the IPython notebooks as well. While I haven't made the switch completely yet, I always keep an IPython session around in an extra tab, since it is very often just much simpler to do something there than in bash.

>I always keep an IPython session around in an extra tab By "tab" you mean tab in your web browser; do you not? (I ask because there are non-web-based IPython thingies.)

I actually meant a terminal tab (I'm using Tilda as terminal emulator). I'm only really using the web-based notebook interface when I need to display graphics for something.

Re: Rich Command Shells

#96

Earlier quoted context omitted.

I'm honestly not sure if your post is meant to be satire or not. >lists: ls -1 | wc -l The computer has taken a real array (probably an array in C), joined all the items together into one big string using magical characters as dividers, and then split it again on those magic characters to try and reconstruct the metadata that it threw away. I think the problem is pretty obvious and well known. >would unix be better i…

So your argument is that ls is not efficient enough in its implementation, but that you would suggest replacing all of that with an object model that implements the equivalent of Ruby's enumerable. Got it. Shell is easy to learn because people innately understand "and then do this with it". You can start with ls, get to ls -1, then think, I want to count these, and get to wc -l. Yeah, there are exceptions -- e.g., fi…

>So your argument is that ls is not efficient enough in its implementation

My complaint wasn't about the efficiency of ls, it was the fact that valuable information that is required for correctness is thrown away to achieve compatibility with the unix 'stream of text' interface and the attempt to recover that information leads to incorrect results. The paradigm is just fundamentally broken.

>you would suggest replacing all of that with an object model that implements the equivalent of Ruby's enumerable. Got it.

I don't even like Ruby at all (ironically, I find its grammar far too complex and shell-like to be able to parse in my head), so I've no idea what you are talking about. You seem to be assuming that everybody who dislikes the shell must be some strawman hipster.

>there are exceptions -- e.g., files with newlines in their name

I honestly find it extremely bewildering that any programmer would see that as being acceptable. It's not just that it fails to give the correct result, it fails silently. Silent data corruption is surely just about the worse class of bug.

>But pedagogically, I can assure you that teaching people shell is easier than teaching them map-reduce.

I presume you mean the functional ideas of map, reduce, and filter, not MapReduce ( https://en.wikipedia.org/wiki/Map-reduce ). The latter is irrelevant to the discussion.

My experience is the exact opposite. I found understanding the concepts of map and filter trivial. If you can understand a loop you can understand them. Reduce/fold isn't hard to understand either, although a bit tricker to make use of. Your example didn't use reduce anyway. Map and filter are typically much easier to use and reason about than a for loop in C, or a chain of commands in a shell script.

The shell is an absolute nightmare to learn. I have tried to learn to use it numerous times of the last decade or so, and I have always forgotten it the next time I come to do anything in the shell. The amount of knowledge you need to actually do anything is huge (the awk language, obscure and terse command names, complex regexes, memorising a bunch of command flags, memorising the output format of commands - usually a format designed for displaying to users rather than machine parsing, the shells ridiculously complex grammar, how to escape things etc etc) Your example illustrates that. It would have taken me 20 mins at least to put together that line of code you gave. Also, it's not like you escape having to understand concepts like map and filter. If you don't understand them (not necessarily by name) then you won't be able to write the line of unix commands you gave.

>Shell is easy to learn because people innately understand "and then do this with it".

People might find the concept of piping data easy to understand (I'm not convinced they do to be honest), but that alone won't do them much good because as your examples showed, you always need to run a bunch of complex and obscurely named commands, regex, or awk on the data to make the next command able to understand it.

Re: Rich Command Shells

#97
post #95

Earlier quoted context omitted.

>I always keep an IPython session around in an extra tab By "tab" you mean tab in your web browser; do you not? (I ask because there are non-web-based IPython thingies.)

I actually meant a terminal tab (I'm using Tilda as terminal emulator). I'm only really using the web-based notebook interface when I need to display graphics for something.

I am very glad I asked :)

Re: Rich Command Shells

#98

Earlier quoted context omitted.

So your argument is that ls is not efficient enough in its implementation, but that you would suggest replacing all of that with an object model that implements the equivalent of Ruby's enumerable. Got it. Shell is easy to learn because people innately understand "and then do this with it". You can start with ls, get to ls -1, then think, I want to count these, and get to wc -l. Yeah, there are exceptions -- e.g., fi…

>So your argument is that ls is not efficient enough in its implementation My complaint wasn't about the efficiency of ls, it was the fact that valuable information that is required for correctness is thrown away to achieve compatibility with the unix 'stream of text' interface and the attempt to recover that information leads to incorrect results. The paradigm is just fundamentally broken. >you would suggest replaci…

>> there are exceptions -- e.g., files with newlines in their name

> I honestly find it extremely bewildering that any programmer would see that as being acceptable. It's not just that it fails to give the correct result, it fails silently. Silent data corruption is surely just about the worse class of bug.

Yes! We should strive to build our software on solid, non-leaky abstractions as much as possible, so that exceptions like a filename with an odd character in it just don't exist. Until we reach that point, computers will continue to frustrate their users for no good reason.

Re: Rich Command Shells

#99
post #38

Earlier quoted context omitted.

I have used PowerShell, and currently learning Clojure. They never occurred to me as being similar - or did I miss the point?

Is a very subtle one. Imagine having a workstation where the whole stack is written in Clojure (e.g. Lisp Machine). Now when you open a REPL window, similar to what Common Lisp Interface Manager is, you can (:require) anything public from the OS, including applications, to interact with. Powershell is similar in that, you are using objects and are able to reference any .NET class, COM instance or public functions fro…

Office COM automation is what I did. I get what you mean, but in my experience, interfacing with native code is not always straightforward. Also there are odd cornercases where you need to fallback to p/invoke.

But More importantly, you can't change anything, you can only use it. So the FFI is nice and easy, but you could say the same about other languages. Or am I confusing things with Smalltalk images? Cl was somewhat before my time.

Re: Rich Command Shells

#100
post #25
post #11

Given all of that, and also Oberon -- '80s too, and even the Engelbart's Demo -- '68!, I totally every day wonder and can't understand why in 2010's all of the "modern" OSes still provide the developer just with text-only consoles??... okay, maybe for end-users there was a jump (in interfaces and features), and maybe it was significant indeed (movies editing, 3d modelling/sculpting, possibility of instant communicati…

For me, because I can't compose strings of gui clicks into an ad hoc list of transformations on text. And I do that a lot in the shell. There is also no command history for my gui clicks; once you've clicked on something, there's no way to reuse that click in some slightly different way.

In CLIM, a graphical presentation is only a representation of an underlying type. Types will have default representation (e.g., basic text like you would get from printf), but you can also override this using with-output-as-presentation (see p. IV-1.30 of [1]).

So, when outputting a number, you could display it in the output stream as a circle of radius N. Then, any input which wanted a number as argument (using "(accept 'integer ..)") would let you type a number or click on that circle.

This could be extended to shell command parser for richer input choices (rmdir can only accept directories, cat won't). Existing utilities could support a "richly typed stream of objects" (graphical ls) or a wrapper or output processor could add it. The latter has the advantage that not all commands would need to be aware, and it could be multi-functional (could work on "ls|grep", "find", "tar tf" output--but you might need to specify type hints).

I think it would be handy to have all my recent files, directories, outputs handy in a list on the side (with keyboard shortcuts too; I'm not a clicker..).

So in no way should your command history have to be compromised just because you have alternative input methods available.

[1] A Guided Tour of the Common Lisp Interface Manager, http://3e8.org/pub/scheme/doc/lisp-pointers/v4i1/p17-rao.pdf

Post reply on HN