Skip to content
MethodoxTechPublic

About

A simple shell that works cross-platform.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Easy Shell (easy)

Type: Shell Scripting Language
Program: easy
Extension: .easy Version: 0.1.0

A simple shell that works cross-platform. It can't get easier.

EasyShell brings simplicity to process automation - with a handful of syntax, it enables automating common build tasks.

Easy Shell is a minimal shell scripting language implemented in C#. It combines:

  • Shell-like “one command per line” scripting
  • Strongly-typed global variables
  • Control-flow keywords (IF/ELSE/WHILE/FUNC/CALL)
  • Direct invocation of fully-qualified .NET members (methods, fields, properties)
  • Sub-command expressions using parentheses for inline evaluation

Design Notes

  • It's minimal and for lazy people - no advanced bash like functions and mostly for scripting use. Also less risk of "forgetting some keyword/syntax" (like often with PowerShell).

  • Serve as a successor to MiniParcel for shell purpose so MiniParcel can focus more on a "human-readable graph language".

  • Default value interchange format is string, but variables enforce a declared type.

  • Reflection invocation attempts to match overloads by argument count + best conversion fit.

  • External executable calls return stdout (or stderr when stdout is empty) when used as an expression; at an interactive prompt a bare command instead takes the terminal, so python, pwsh and vim work.

Features

  • Strongly typed variables via INT, BOOL, STRING, DOUBLE, HANDLE
  • Interactive prompts - PROMPT and CHOOSE, with ARGVALUE to skip them unattended
  • Case-insensitive variable names
  • Global scope for all variables (no function parameters needed)
  • Expressions as parenthesized sub-commands: (== $X 10) or (System.String.Format "x={0}" $X)
  • Control flow
    • IF ... ELSEIF ... ELSE ... END
    • WHILE ... END
    • FUNC name ... END and CALL name
  • Arithmetic with +, -, *, /, %, ^ - head first, any number of operands
  • Compound assignment with +=, -=, *=, /=, %=, ^=, in either spelling
  • String concatenation with || (or CONCAT/APPEND), any number of arguments
  • Reflection-based .NET invocation
    • Static: System.IO.File.WriteAllText "path" "content"
    • Instance: System.DateTime.AddDays $Now 15 (first argument is the target)
    • Instance on a handle: CALL $handle MethodName [args...]
    • In the Native build, or in a sandbox, through a curated library bound at compile time instead - see Two builds and Docs/NativeAOT.md
  • External process execution for non-keyword, non-qualified commands, captured in scripts and run in the foreground at an interactive prompt
  • A line-editing prompt with history, cursor motion and Tab completion
  • Script arguments via HASARG / ARG and $EasyArgs
  • File system commands including REMOVEALL for deleting by wildcard
  • Wildcards - cat pets/*, ls docs/*/notes*.txt: unquoted program arguments expand to the files they match
  • Comments with #

Repository Layout

Project
EasyShell/ The library: parser, runtime, executor, reflection, process invocation, terminal state, and the shared interactive prompt loop under Interactive/.
EasyShell.Cli/ The easy executable - argument handling and the help text, and nothing else.
EasyShell.Generators/ The source generator that turns [assembly: ShellBindType(typeof(T))] into a curated library of direct calls, which is how easy calls .NET under NativeAOT. It runs inside the compiler and ships nothing.
Docs/ Design notes: NativeAOT.md.
EasyShell.Tests/ The unit tests. See Testing.

The library has no dependencies beyond the .NET runtime, and that is a constraint worth keeping: easy is a build tool that has to clone and build on its own, and a host that embeds the engine should not inherit that host's own dependency graph in return. Terminal handling is the case where this was tempting to break - it is why TerminalState is 150 lines of self-contained P/Invoke here rather than a reference to somebody's terminal library.

Anything that a host embedding EasyShell could want belongs in the library. The prompt loop is the clearest case: HeadlessTerm's RetroShell wants an EasyShell prompt with its own banner, prompt string and built-ins, and nothing else of its own - so block accumulation, exit codes, error reporting and result printing live in Interactive/EasyShellRepl.cs and the differences are ReplOptions.

Usage Guide

Example Script

# Get time as handle
HANDLEVAR NOW (System.DateTime.Now)

# Convert time to string via instance call
STRINGVAR DATE (CALL $NOW ToString)

# Prepare content via static call
STRINGVAR VALUE (System.String.Format "Current time: {0}" $DATE)

# Write file
STRINGVAR PATH "C:/Value"
System.IO.File.WriteAllText $PATH $VALUE

Distinguish between argument and expression

easy> $Date = (format "{0:yyyyMMdd}" (GetDate))
easy> print $date
20251214
easy> $Date = (format "{0:yyyyMMdd}" GetDate)
easy> print $date
GetDate

Quick Start

Run

easy # REPL
easy path/to/script.easy

The REPL

easy with no arguments (or easy --repl) is a line-editing prompt: arrow keys move the cursor, Up and Down walk the history, and Tab completes. One pool of candidates is offered for every word, with no special case for the first one - a program name can come out of a variable and RUN takes one as an argument, so a grammar-shaped guess would be wrong as often as it was right:

Typed Offered
pri built-in commands and block keywords: print
$Easy variables bound in this session: $EasyArgs, $EasyScriptRoot, ...
dotn programs on PATH: dotnet (on Windows, without the PATHEXT suffix)
Scri files and folders around the working directory: Scripts/

A folder keeps its trailing separator so the next Tab descends into it. A word that already contains a separator is a path and nothing else - bin/pri will not offer print. An empty word lists the working directory rather than several thousand commands.

Piped input (echo 'print hi' | easy --repl) keeps reading whole lines, because keys cannot be read from a pipe.

Help / Version

easy --help
easy --version
easy --build      # which of the two builds this is: Full or Native

easy's own options come before the script path; everything after the script path belongs to the script, --help and --version included.

Language Overview

Comments

Anything after # is ignored.

# This is a comment
STRINGVAR Name "Charles"  # trailing comment

Variables

Declare variables with a type command:

INTVAR Count 10
BOOLVAR Enabled TRUE
DOUBLEVAR Pi 3.14159
STRINGVAR Title "Hello"
HANDLEVAR Now (System.DateTime.Now)

Rules:

  • Variable names are case-insensitive
  • Variables are strongly typed
  • HANDLE stores an object instance (from .NET calls or other results)
  • Empty strings are supported, e.g. STRINGVAR VALUE ""

Variable Reference and Assignment

Reference: $Name

Assignment:

$Count = 11
$Title = "Updated"

Values can be literals or expressions:

$Title = (System.String.Format "Count={0}" $Count)

Compound assignment - +=, -=, *=, /=, %=, ^= - abbreviates reading a variable, applying an operator and writing it back. Both spellings mean the same thing, because the language has two shapes and each is the obvious guess from one of them:

$Count -= 1        # infix, like the assignment above
-= $Count 1        # head first, like every other operator

Either is exactly $Count = (- $Count 1), so the variable has to exist already, integer arithmetic stays integer, and += concatenates as soon as an operand is not a number:

$Tag = "build"
$Tag += "-42"      # build-42

Literals

  • Strings: "hello world"
  • Booleans: TRUE, FALSE (also accepts YES/NO)
  • Integers: 123
  • Doubles: 3.14

An unquoted word that looks like a number is a number, 0 and 1 included, so $i = 0 declares an INT and counts the way you would expect. They still read as conditions where one is wanted - IF 1, and (== $Flag 1) against a boolean - because a non-zero number is true and a comparison falls back to comparing both sides as booleans when they are not both numeric.

Quoting is what keeps a literal a string: "1.0" is a version, 1.0 is the number one.

Commands

A line is generally a command invocation:

  1. Keywords (language built-ins)
  2. External executables (e.g., git, ping, curl depending on environment)
  3. Fully-qualified .NET members (reflection invoked)

Expressions (Sub-Commands)

Any argument may be an expression: a parenthesized command that is evaluated first and yields a value.

STRINGVAR X "10"
BOOLVAR IsTen (== $X 10)

Built-in Comparison Commands

  • ==, !=, >, <, >=, <=

Examples:

BOOLVAR A (== 5 5)
BOOLVAR B (> 10 2)
BOOLVAR C (<= 3 3)

Built-in Arithmetic Commands

  • +, -, *, /, %, ^

Every operator is head first and takes as many operands as you like:

$Sum = (+ 1 2 3)      # 6
$Neg = (- 5)          # -5, unary
$Pow = (^ 2 10)       # 1024

The result stays an INT when every operand is an INT and the operator cannot produce a fraction (+, -, *, %); otherwise it is a DOUBLE.

An operand that is not a number is an error rather than a zero:

$n = (- 10 "ten")  # (Error) 1: - expects numbers; 'ten' is not one.

Text that parses as a number still counts as one, so a count read out of a file or an environment variable is fine. + is the deliberate exception: it concatenates instead, which is what += above relies on. Use || when joining text is what you always mean.

Built-in String Commands

  • ||, CONCAT, APPEND - the same command under three names
$Name = "EasyShell"
$Version = "0.1.0"

$Archive = (|| $Name "_v" $Version ".zip")     # EasyShell_v0.1.0.zip
$Archive = (CONCAT $Name "_v" $Version ".zip") # identical

Every argument is converted to its string form first, so numbers, booleans and handles can be mixed in freely:

print (|| "Built " 3 " packages, ok=" TRUE)    # Built 3 packages, ok=TRUE

+ doubles as concatenation when an operand is not a number, which keeps the common case short:

$Tag = (+ "build-" 42)     # build-42
$Total = (+ "10" 1)        # 11 - both operands are numeric, so this is still arithmetic

Prefer || whenever you mean concatenation regardless of what the values look like - + only falls back once something is genuinely non-numeric.

Script Arguments

Everything after the script path belongs to the script:

easy Publish.easy --incremental
IF (hasarg "--incremental")
  print "Skipping the clean step."
END

print (|| "Called with " $EasyArgCount " argument(s): " $EasyArgs)
print (arg 0)     # "--incremental"; an index that is not there reads as ""

HASARG ignores case. ARG returns an empty string rather than failing when the index is out of range, so an optional argument needs no guard around it.

ARGVALUE <flag> [default] reads the value that follows a named flag, which is the shape most build scripts actually want:

easy Publish.easy --channel Steam
$Channel = (argvalue "--channel" "Steam")

A flag that is absent - or present with nothing after it - yields the default, so there is nothing to guard.

Asking the User

  • PROMPT <message> [default] - one line of free text
  • CHOOSE <message> <option> [option...] - a numbered menu
$Name = (prompt "Release name?" "Nightly")

$Channel = (choose "Publish to which store?" "Steam" "Itch.io" "Mac App Store")
print (|| "Building for " $Channel)
Publish to which store?
  1) Steam
  2) Itch.io
  3) Mac App Store
Enter 1-3 or a name: 2
Building for Itch.io

CHOOSE accepts the index, the full name (case-insensitively) or any unambiguous prefix, and asks again when it gets anything else. A prefix shared by two options is refused rather than resolved to whichever was listed first.

The two differ deliberately in what they do when nobody is there to answer - a piped session, a CI job, a redirected stdin:

End-of-input
PROMPT Takes the default. An optional question should not stop an unattended run.
CHOOSE Fails, naming the options.

CHOOSE has no default on purpose. The question it exists for - which store is this build for - has no safe guess, and quietly picking the first option is how a Steam build ends up uploaded to Itch.io. Pair it with ARGVALUE to make the prompt the interactive fallback rather than the only path:

# Asks when run by hand; silent when run as `easy Publish.easy --channel Steam`
$Channel = (?? (argvalue "--channel") (choose "Publish to which store?" "Steam" "Itch.io"))

Both are host-routed, so they follow a virtualized ShellHost into its own console like every other built-in.

File System Commands

  • MKDIR <path>, REMOVE/RM <path>, CP <source> <target>, MV <source> <target>
  • EXISTS <path> - true for a file or a directory
  • JOINPATH <part> <part> [...], RESOLVE <path> - JOINPATH accepts either separator and joins with the host's own, so a virtual machine's prompt joins with its / even on Windows
  • REMOVEALL <folder> <pattern> [recursive] - deletes every file matching a wildcard and answers with how many went, recursively unless told otherwise
# Strip XML documentation out of a publish folder, at any depth
$Removed = (removeall $PublishFolder "*.xml")
print (|| "Deleted " $Removed " XML file(s).")

# Only the top folder
removeall $PublishFolder "*.log" FALSE

Directories are never matched, so a pattern like * cannot quietly take a folder with it, and a folder that does not exist deletes nothing rather than failing - it is already in the state the caller asked for.

Wildcards

An unquoted word with *, ? or [...] in it, given to a program, becomes the list of paths it matches - the same pathname expansion every shell does:

cat pets/*                 # cat pets/cat.txt pets/dog.txt
ls docs/*/notes*.txt       # a pattern can sit in any segment of a path
wc -l chapter[1-3].md      # [abc], [a-z], and [!a-z] or [^a-z] for "not these"
echo "*"                   # quoted: a star, never a file list
  • * matches any run of characters within one name, ? exactly one, and [...] one of a set; none of them crosses a /.
  • A name that starts with . is matched only by a pattern that starts with . too, so * leaves hidden files alone and .* asks for them.
  • Matches are sorted (ordinally, so the order is the same on every machine), and the parts of the path you typed literally come back exactly as you typed them.
  • A pattern that matches nothing is passed on unchanged, so cat x* has cat report the missing file in its own words, rather than running cat with no arguments to sit waiting on its input.

The rule for when a word expands is one sentence: only an argument to a program, only in non-head position, and only unquoted. It is the pipe rule with one more clause, and the extra clause is what keeps the rest of the language as it was. * is also the multiplication command, and (* 2 3) is still 6 - the * there is the head, and an operator is not a program. Arithmetic, comparisons, declarations, keywords, functions, .NET calls and the built-ins (print, rm, cp, removeall and the rest) take their words verbatim, because their arguments are values rather than file lists: removeall $Folder *.xml means the pattern, as it always has, not whatever the working directory happens to hold. A $variable or a (sub-expression) is never expanded either, because its value was not typed as a pattern. RUN <program> <args...> and every stage of a pipeline are programs, so their arguments do expand.

Expansion looks through the host's filesystem, so easy expands against the real disk and an embedded shell - a virtual machine's prompt - against its own.

Control Flow

IF / ELSEIF / ELSE / END

INTVAR X 10

IF (>= $X 10)
  STRINGVAR Msg "X is at least 10"
ELSEIF (== $X 9)
  STRINGVAR Msg "X is 9"
ELSE
  STRINGVAR Msg "X is something else"
END

WHILE / END

INTVAR I 0

WHILE (< $I 3)
  System.Console.WriteLine (System.String.Format "I={0}" $I)
  $I = (+ $I 1)
END

Functions

Functions are named blocks with global variable access. They do not take arguments; “return values” are done by setting variables.

Define a function

FUNC WriteGreeting
  System.Console.WriteLine "Hello from a function"
END

Call a function

CALL WriteGreeting

Calling .NET

Static members (fully qualified)

System.Console.WriteLine "Hello"
STRINGVAR S (System.String.Format "X={0}" 42)

Static property/field access (no arguments):

HANDLEVAR Now (System.DateTime.Now)

Instance members as command names

A fully-qualified name may also be an instance member. The first argument is the instance it runs on, so the syntax stays head first:

HANDLEVAR Now (System.DateTime.Now)

# Same as $Now.AddDays(15)
HANDLEVAR Later (System.DateTime.AddDays $Now 15)

# Instance properties work the same way: $Now.Year
INTVAR ThisYear (System.DateTime.Year $Now)

# The target does not have to be a handle - anything convertible works
STRINGVAR Shout (System.String.ToUpper "hello")

Resolution order for Type.Member <args...>:

  1. static field
  2. static property (no arguments)
  3. static method whose overload accepts all the arguments
  4. instance member, using the first argument as the target

So a static member always wins when one fits; the instance form is what happens next rather than something you have to ask for.

Instance calls via HANDLE

CALL <handle> <method> [args...] names the method separately, which is handy when the method name itself comes from a variable, or when the type name is long:

HANDLEVAR Now (System.DateTime.Now)
STRINGVAR Stamp (CALL $Now ToString)
System.Console.WriteLine $Stamp

Overload matching

Overloads are matched by argument count and conversion fit. Optional parameters may be omitted, and params arrays are filled from the remaining arguments:

print (System.String.Format "{0}-{1}-{2}-{3}" 1 2 3 4)   # params object[]

Publish

Prerequisites

  • .NET SDK (recommended: .NET 8+)
  • Powershell 7 (for first build)
  • Alternatively, EasyShell binary
  • Alternatively, build directly with dotnet

Testing

dotnet test

EasyShell.Tests is an xUnit project covering the parser and tokenizer, value and variable semantics, every built-in command and alias, control flow including EXIT and RETURN, the reflection binder, external process execution (capture, foreground, exit codes and the wall-clock timeout) and the interactive prompt loop. It has no dependencies of its own beyond the test runner, and it runs in a few seconds.

Two things about it are worth knowing before adding to it:

  • Tests do not run in parallel, deliberately. A shell is made of process-global state - Console.In/Console.Out, the working directory, PATH, the script-argument table - and the tests borrow all of it. See AssemblyInfo.cs.
  • External programs are written by the tests themselves (Infrastructure/ProgramProbe.cs), as sh scripts on Unix and .cmd on Windows, in a temporary folder placed on PATH. Borrowing a system program instead would make the tests depend on what happens to be installed.

The publish scripts run the tests before publishing. Pass --skip-tests to skip that.

Build

Use pwsh from the BuildScripts folder:

pwsh ./BuildEasyShell.ps1

Or using easy itself:

easy ./BuildEasyShell.easy

Or using dotnet:

dotnet run -- ./BuildScripts/BuildEasyShell.easy

Each of these builds the Full easy; see Two builds for the Native one.

Two builds: Full and Native

easy comes in two builds, made from the same source and running the same language:

Full Native
What it is Self-contained .NET on the JIT, the distribution as it always was One NativeAOT executable
How scripts call .NET By reflection: any type a script names, any assembly LOADASSEMBLY loads Through the curated Standard library its source generator bound at compile time: 25 types (strings, numbers, dates, regular expressions, paths, files, directories, environment, archives)
A type outside that Works Does not exist: the name goes to the program path, so it is "command not found"
LOADASSEMBLY Loads Refused: the surface was fixed when the program was built
Size on win-x64 77.6 MB in 192 files 5.2 MB, one file
Who ships it The EasyShell distribution, for build automation where reaching any type is the point Divooka Compute and The Elder Machine, where a fixed surface is the point
Package Utility_EasyShell_<rid>_v<version>_B<date>.zip Utility_EasyShellNative_<rid>_v<version>_B<date>.zip
Published to <build-root>/Publish/Utilities/EasyShell/Current <build-root>/Publish/Utilities/EasyShellNative/Current

Both build scripts take the build's name, Full by default:

pwsh ./BuildEasyShell.ps1 -Build Native
easy ./BuildEasyShell.easy --build Native

Or with dotnet, where EasyShellBuild is the switch:

dotnet publish EasyShell.Cli -c Release -r win-x64 -p:EasyShellBuild=Native

The Native build treats every trim and AOT warning as an error, because each one would be a script call that fails at run time. It needs the platform's C/C++ linker: on Windows, Visual Studio's C++ build tools. (Visual Studio 18's vcvarsall.bat runs vswhere.exe by bare name, so the build scripts put the Visual Studio installer folder on PATH when it is not; a plain dotnet publish without it fails to link with MSB3073.) easy --build says which build a binary is.

BuildScripts/VerifyNative.ps1 is the check that a Native build is right. It publishes both builds from a clean intermediate folder, requires the Native publish to report no warnings at all, runs every script in Examples/ with each build and requires a zero exit code and identical output from both, and checks the one intended difference - a type outside the Standard library (System.Uri) works in Full and does not exist in Native, and LOADASSEMBLY is refused. Run it after changing the binder, the libraries or the generator:

pwsh ./BuildScripts/VerifyNative.ps1

Expected folder structure:

<build-root>/
├─ External/
│  └─ EasyShell/
│     ├─ BuildScripts/
│     │  ├─ BuildEasyShell.easy
│     │  └─ BuildEasyShell.ps1
│     ├─ EasyShell/              # the library - engine, parser, runtime, process invocation
│     │  └─ EasyShell.csproj
│     ├─ EasyShell.Generators/   # the binding generator for curated libraries
│     │  └─ EasyShell.Generators.csproj
│     ├─ EasyShell.Cli/          # the `easy` executable
│     │  └─ EasyShell.Cli.csproj
│     ├─ EasyShell.Tests/        # the unit tests
│     │  └─ EasyShell.Tests.csproj
│     ├─ Examples/
│     └─ EasyShell.sln
├─ Publish/
│  ├─ Utilities/
│  │  └─ EasyShell/
│  │     └─ Current/
│  └─ Packages/

The build scripts live directly under External/EasyShell/BuildScripts.

It uses:

$BuildRoot = (Get-Item -LiteralPath $PSScriptRoot).Parent.Parent.Parent.FullName

So BuildScripts must be three levels below <repo-root>:

<build-root>/External/EasyShell/BuildScripts

The script publishes External/EasyShell/EasyShell.Cli into:

<build-root>/Publish/Utilities/EasyShell/Current         # Full
<build-root>/Publish/Utilities/EasyShellNative/Current   # Native

Then creates a package in:

<build-root>/Publish/Packages

Changelog

  • v0.1.0: Initial setup.

  • v0.1.1 (Unreleased):

    • Script arguments: HASARG, ARG, $EasyArgs, $EasyArgCount
    • REMOVEALL <folder> <pattern> [recursive] for deleting files by wildcard
    • String concatenation: || / CONCAT / APPEND, and + when an operand is not a number
    • Instance members as command names: System.DateTime.AddDays $Now 15
    • Overload matching honors optional parameters and params arrays
    • Errors from .NET calls report the script line, and report what the callee complained about
    • # inside a quoted string is no longer treated as a comment
  • v0.2.0 (Unreleased):

    • Split into a library (EasyShell/) and the easy CLI (EasyShell.Cli/), so other projects can join the solution and so hosts can reference the engine without pulling in an executable
    • ProcessInvoker.RunForeground and $EasyInteractive: at an interactive prompt, a statement-context external program inherits stdin/stdout/stderr instead of being captured through pipes. Without it python and pwsh see a non-tty, skip their REPL and exit immediately, and vim hangs on /dev/tty. Scripts are unchanged - a closed stdin is exactly what keeps a prompting tool from blocking CI - and expression context always captures
    • RUN <program> [args...] runs a program even when a built-in or alias shadows its name
    • TerminalState snapshots and restores the tty around every foreground child, so a program that dies without unwinding cannot leave the prompt in raw mode
    • Dotted names are resolved against PATH before being treated as .NET calls, so vim.tiny, python3.12, node.exe and every Windows .cmd/.bat are reachable at all
    • The REPL loop moved into the library as EasyShell.Interactive.EasyShellRepl and takes ReplOptions, so a host supplies only its banner, prompt and built-ins
  • v0.3.0 (Unreleased):

    • EasyShell.Hosting: the virtualization seam. A Runtime now carries a ShellHost - console, filesystem, process runner, environment - defaulting to the real machine with behavior unchanged. A host that substitutes all four (a virtual machine whose filesystem is a portable image, whose processes are a virtual process table, whose console is a tty) gets the entire language and REPL inside its world: same parser, same semantics, zero drift
    • The machine-touching aliases (cd, cwd, resolve, exists, setenv, getenv, hasarg, arg, mkdir, remove/rm, removeall, cp, mv, print, rpl, regrpl) became host-routed built-ins; only pure or deliberately host-only targets (joinpath, format, sqrt, getdate, zip) remain reflection aliases. Behavior on the default host is unchanged and pinned by the alias tests
    • ShellHost.CanInvokeQualified: reflection policy. Direct .NET invocation is EasyShell's superpower on the host and its biggest escape hatch in a sandbox; a virtualizing host can refuse or allowlist fully-qualified names, and refusals read as ordinary script errors
    • Script arguments (HASARG/ARG) are per-Runtime, so embedded sessions cannot see each other's flags
    • Both reflection paths are gated. CALL <receiver> <member> reached ReflectionInvoker.InvokeInstance without consulting the policy, so CALL "" GetType walked String -> Type -> Assembly -> GetType("System.IO.File") -> Invoke and escaped a sandbox that correctly refused the same call written as System.IO.File.WriteAllText .... Instance calls are now gated on the concrete receiver type plus member name
    • Separator normalization moved onto IShellFileSystem.NormalizeSeparators. The file built-ins folded '/' onto Path.DirectorySeparatorChar, which is right for the real machine and wrong for a virtual filesystem with its own convention: on Windows a pocket path /home/x became \home\x and silently matched nothing. The default host keeps the old behavior; a virtual host returns the path unchanged
    • Tab completion at the easy prompt. The line editor and its completion plumbing already existed, and were used only by PocketOS - the CLI never implemented IShellLineInput, so the REPL read whole lines and Tab reached the line discipline and inserted a tab character. HostConsole now delivers keys, and ShellCompletionSource offers built-in commands, the session's variables, programs on PATH, and files and folders around the working directory. IShellLineInput.IsInteractive keeps a piped session on the whole-line path
    • Compound assignment: $a -= 1 and -= $a 1, for every arithmetic operator. -= was not a token, so -= $a 1 ran as - applied to =, $a and 1 - a statement that computed a number, discarded it, and left $a alone, which made a countdown loop run forever in silence
    • Arithmetic refuses a non-numeric operand instead of coercing it to 0, so a typo or an unset variable is reported rather than quietly contributing a zero. + still concatenates
    • cmd.exe /c quoting. A .bat/.cmd invoked with an argument containing a space failed on Windows whenever the script's own path also contained one - cmd preserves quotes only when there are exactly two on the line and otherwise strips the outermost pair, so the command line came apart and the caller saw "exited with code 1" with no output. The line is now built explicitly under /S
    • The "takes a single value" diagnostic no longer suggests re-wrapping an expression that is already parenthesized; it names the leftover words instead, and calls out a trailing :
    • Asking the user: PROMPT <message> [default] and CHOOSE <message> <option...>, plus ARGVALUE <flag> [default] for the value after a named flag. Both prompts are host-routed, so they work inside a virtualized host. CHOOSE deliberately has no default and fails on end-of-input rather than picking the first option - a publish script that guesses which store it is building for is worse than one that stops
    • Wildcards: *, ? and [...] in an unquoted program argument expand to the matching paths, sorted, through the host's filesystem - so cat pets/* works at easy's prompt and inside a virtual machine alike, where it used to hand cat the literal pets/*. Only program arguments expand: (* 2 3), removeall $dir *.xml and every other language command see their words exactly as before. Hidden names need a pattern starting with ., and a pattern that matches nothing is passed on as typed, as in POSIX
    • Two builds, Full and Native. The Full build is the distribution as it was; the Native build is the NativeAOT easy that Divooka Compute and The Elder Machine ship, chosen with -Build Native / --build Native / -p:EasyShellBuild=Native, packaged as Utility_EasyShellNative_..., published with trim and AOT warnings as errors, and checked against the Full build by BuildScripts/VerifyNative.ps1. easy --build says which one is running. See Two builds
    • joinpath and getdate belong to the host. They were aliases onto CommonUtilities.JoinPath and System.DateTime.Now, so inside a virtual machine joinpath joined with the real machine's separator (a backslash on Windows) and getdate read the real machine's clock. They are host-routed built-ins now: joinpath joins through IShellFileSystem.Join (Path.Join on the default host, so nothing changes there) and getdate reads ShellHost.Clock (TimeProvider.System by default). The Computation library lost CommonUtilities and DateTime.Now/UtcNow/Today accordingly, so it holds nothing of the machine it runs on; HostMachine binds all of DateTime, so Standard is unchanged
    • An alias whose target the host's library does not bind is not a command: on a Computation host zip is whatever program answers to it, or "command not found"
    • The prompt is easy>, and the help text says easy <script.easy>: the program, the language and the extension are all easy
    • easy's own options are read only before the script path, so easy Build.easy --build Native passes --build to the script
    • NativeAOT. A script's .NET calls go through its host's ShellHost.Library: the whole runtime by reflection where that works, or a curated library whose members EasyShell.Generators bound at compile time. A NativeAOT easy used to build with nine trim warnings and then fail every .NET call at run time, because the trimmer kept nothing a script names only by string; it now publishes with none and calls the Standard library (Computation and HostMachine, 25 types). The binder's rules are shared by both libraries and a parity test holds them to the same results; under the JIT nothing changes. See Docs/NativeAOT.md

License

MIT

Contributing

  1. Fork / branch
  2. Add tests for new language features
  3. Keep scripts in Examples/ small and focused
  4. Open a PR with a short description of behavior changes

See Also

About

A simple shell that works cross-platform.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages