Skip to content

DarThunder/iDar-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iDar-Shell

The modular, extensible, Unix-like command-line environment for ComputerCraft.

iDar-Shell is a robust command interpreter designed to organize and interact with the iDar ecosystem. What started as a temporary solution has evolved into a full-featured shell that supports input/output redirection, command history, a chrooted filesystem, and its own built-in clone of the vi editor.

Instead of being a monolithic console, iDar-Shell delegates its operations to independent programs (ls, cat, rm, mkdir), allowing the system to grow without needing to modify the core.

Table of Contents

Features

  • Modular Architecture: Commands are not hardcoded into the shell (except for built-ins like cd). If you need a new command, simply add a .lua file to /iDar/bin/.
  • Built-in vi Clone: Includes a functional text editor with classic modes (Normal, Insert, and Command modes), navigation using h, j, k, l, and quick saving with :wq.
  • I/O Redirection: Native support for redirecting any command's output to a file using > (overwrite) or >> (append).
  • Persistent History: Browse your last 50 commands using the arrow keys. History persists across reboots by being saved to .dsh_history.
  • Pointer Files (.ptr): A lightweight alternative to symbolic links (symlinks) for creating aliases or shortcuts to executables located elsewhere.
  • Secure Environment (Chroot): The shell and its utilities are restricted to the /iDar directory, protecting the rest of the filesystem from accidental modifications.

Installation

Assuming you are using iDar-Pacman to manage your ecosystem, installation is as simple as:

pacman -S idar-shell

(Alternatively, you can manually clone the files from the /src/ directory into your project.)

Usage

Once started, iDar-Shell will present its custom prompt showing the machine name and the current directory.

Basic Examples

# Navigate the system (always within /iDar)
cd src/shell_programs/

# List files
ls

# Create a file and write to it using redirection
echo "City boy City boy" > greeting.txt

# Read the file
cat greeting.txt

# Edit a file with the built-in editor
vi greeting.txt

Keyboard Shortcuts

The iDar-Shell command line supports classic key combinations to boost productivity:

  • Ctrl + L: Clears the screen.
  • Ctrl + A: Moves the cursor to the beginning of the line.
  • Ctrl + E: Moves the cursor to the end of the line.
  • Ctrl + K: Deletes text from the cursor to the end of the line.
  • Ctrl + D: Exits the shell (equivalent to the exit command).

How It Works

When you enter a command, iDar-Shell first checks if it is a built-in function (like cd or echo). If it isn't, it looks for a .ptr file with the command's name inside the /iDar/bin/ directory.

If you use output redirection (>), the core injects a fake_term object that emulates the native terminal, intercepting all write and print functions from the running program to transparently pipe the text directly to the destination file.

FAQ

Q: Can I create my own custom commands? A: Yes! Simply write a Lua script that accepts arguments (using local args = {...}) and save its path in the binaries folder (default is /iDar/bin/). The shell will recognize it immediately.

Q: Why does the cd / command take me to /iDar instead of the real root? A: By design. iDar-Shell uses a sandboxed environment to ensure applications and the user operate safely within the iDar ecosystem without interfering with the game's native configuration files.

Q: What happens if I use iDar-Loom alongside the Shell? A: iDar-Shell is designed to depend on functions provided by iDar-Loom. If you try to run it standalone, it will crash because it expects non-native CC:Tweaked functions (such as sys.wait or sys.spawn). Therefore, you can either use iDar-Loom or create your own syscalls expected by iDar-Shell.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

About

A modular, Unix-like command-line environment for ComputerCraft.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages