Comment

Comment by tubelite

There are two kinds of commands: Javascript commands (like ls, cat) and scripts (ps, kill, man, csv2js, table2js).

Currently, Javascript commands have to be built-in at "compilation" time. (I need to add a load command which will evaluate a new JS command inside the pigshell closure)

Scripts can be anywhere in PATH.

There is an rc mechanism for doing exactly what you want. At boot time, we run /etc/profile, followed by /local/rc.sh - this is a file saved in the browser's localStorage. Mine is very simple:

  HOME=/home
  mount http://localhost:50937/ $HOME
You can create it simply by

  echo "HOME=/home\nmount http://localhost:50937/ $HOME" >/local/rc.sh
or running "edit /local/rc.sh". Edit provides a simple inline CodeMirror-based editor (actually even the CLI is a CodeMirror editor instance). I use vim on the desktop to do any serious editing. If you run psty, /home is a desktop directory visible inside pigshell, so edit on desktop/run in shell is a low-friction process.

If you manage to mess up /local/rc.sh to the point where pigshell is not "booting", then you can boot it in "safe mode" by appending #norc to the URL, i.e. http://pigshell.com/#norc

parent tubelite 12 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton