MXCMD v2.1 - Shell Interpreter / Console for MX2
=================================================
(C) 1999-2025 LostSideDead Software
https://lostsidedead.biz

Online Guide: https://lostsidedead.biz/mxcmd
Source Code:  https://github.com/lostjared/libmx2


WHAT IS MXCMD?
--------------
MXCMD is a lightweight shell scripting language and command-line interpreter
for Windows x64. It provides a built-in set of commands (echo, cat, grep,
find, sort, sed, etc.), control flow (if/elif/else/fi, while/do/done,
for/in/do/done), variables, pipelines, redirection, user-defined functions,
list operations, regex support, and the ability to run external programs
via the "exec" command.

MXCMD ships with two executables:

  mxcmd-cli.exe    - Command-line (terminal) interpreter.
  cmd-console.exe  - GUI console with an OpenGL shader background.


INCLUDED FILES
--------------
  mxcmd-cli.exe       Command-line interpreter
  cmd-console.exe     GUI console application
  SDL2.dll            SDL2 runtime library
  SDL2_mixer.dll      SDL2 mixer library
  SDL2_ttf.dll        SDL2 TTF font library
  libpdcurses.dll     PDCurses library (terminal support)
  libpng16-16.dll     PNG image library
  libreadline8.dll    Readline library (line editing / history)
  libssp-0.dll        Stack protector runtime
  data\               Fonts, icons, and shader files for cmd-console


HOW TO LAUNCH
-------------

1. Command-Line Interpreter (mxcmd-cli.exe)

   Open a Command Prompt or PowerShell window, navigate to this folder,
   and run:

       mxcmd-cli.exe

   This starts an interactive shell session. Type commands at the "$>"
   prompt. Type "exit" or "quit" to leave.

   To run a script file:

       mxcmd-cli.exe script.mxcmd

   Other options:

       mxcmd-cli.exe -h              Show help
       mxcmd-cli.exe -v              Show version
       mxcmd-cli.exe -c "echo hello" Run a single command
       mxcmd-cli.exe -i              Read commands from stdin
       mxcmd-cli.exe -d script.mxcmd Debug output (AST dump)
       mxcmd-cli.exe -s script.mxcmd Syntax-highlighted dump
       mxcmd-cli.exe -t script.mxcmd Token dump

2. GUI Console (cmd-console.exe)

   Double-click cmd-console.exe or run it from a terminal:

       cmd-console.exe

   A window will open with an animated shader background and a console
   overlay. Type commands the same way you would in mxcmd-cli.

   GUI-specific commands:

       random_shader              Set a random background shader
       default_shader             Reset to the default shader
       set_shader "path.glsl"     Load a specific GLSL shader file
       clear                      Clear the console output
       @echo_on / @echo_off       Toggle command echo
       help                       Show built-in command list
       exit                       Close the application

   Press F3 to toggle the console overlay on/off.


QUICK LANGUAGE REFERENCE
------------------------

Variables:
    name = "world"
    count = 0
    count++

Echo / Print:
    echo "Hello, $name"
    printf "%s has %d items\n" $name $count

If / Else:
    if test $count -gt 0 then
        echo "positive"
    elif test $count -eq 0 then
        echo "zero"
    else
        echo "negative"
    fi

While Loop:
    i = 0
    while test $i -lt 10 do
        echo "i = $i"
        i++
    done

For Loop:
    for x in 1 2 3 4 5 do
        echo "x = $x"
    done

Pipelines:
    cat "file.txt" | grep "pattern" | sort

Redirection:
    echo "hello" > "output.txt"
    echo "more" >> "output.txt"
    cat < "input.txt"

User-Defined Functions:
    define greet name do
        echo "Hello, $name!"
    end
    greet "World"

Execute External Programs:
    exec ls -la
    exec python myscript.py

Logical Operators:
    pwd && echo "success"
    pwd || echo "fallback"

Note: All file paths must be enclosed in quotes.

For a full list of built-in commands and detailed syntax, visit:
https://lostsidedead.biz/mxcmd
