Shell
The shell is Medli.CommandConsole — a port of the Medli Legacy CommandConsole, slimmed to drop the Medli Legacy login/screen/filesystem state. It prints a medli~> prompt, reads a line, splits it into a command + argument on the first space, and dispatches to a registered Command.
Each command derives from the abstract Medli.Apps.Command:
public abstract class Command
{
public abstract string Name { get; } // word typed at the prompt
public abstract string Summary { get; } // one-line help
public abstract void Execute(string? param);
public virtual void Help() { ... } // detailed help (overridable)
}
Command reference
| Command | Summary |
|---|---|
help [cmd] | List commands, or detailed help for one |
cls | Clear the screen |
echo <text> | Print text. echo $name prints an environment variable |
$ <name> <value> | Set an environment variable (append -u to overwrite) |
date | Current date (from the RTC) |
time | Current time (from the RTC) |
version | Version, build number, and the Cosmos version built against |
reboot | Power.Reboot() |
shutdown | Stop the shell → the kernel powers the machine off |
panic | Trigger a kernel panic (currently throws to hit the exception handler) |
Notes
date/timereadSystem.DateTime.Now, which is plugged to the RTC in Cosmos gen3 (DateTimePlug) and is architecture-neutral — no original-MedliSysClock/Clockwrappers. Day/month names use hardcoded tables (enum reflection is unreliable under NativeAOT).$/echo $varuse an in-memoryEnvironmentVariablesstore. The Medli Legacy file-backedsave/loadare deferred until the filesystem is ported.panicis a stand-in: the Medli Legacy version fired interrupt 0 viaCosmos.Core.INTs, which has no Cosmos gen3 equivalent, so it currentlythrows.
Adding a command
- Add
Shell/Commands/Foo.cswith aFoo : Commandinnamespace Medli.Apps. - Register it in
CommandConsole’s constructor:_commands.Add(new Foo());(keepHelpCommandlast so it can list everything).
The Medli Legacy shell had ~30 commands (dir, cd, copy, move, rm, mkdir, fdisk, cowsay, the VICS editor, …). Most touch the filesystem/disk/hardware and are ported incrementally — see Porting.