softshell (sfsh)

A Customizable Shell Built with Rust and Lua

Experience a fast, flexible, and highly personalizable command-line environment that combines the performance of Rust with the scripting power of Lua.

Screenshot of sfsh prompt

Craft your unique prompt and commands with ease!

✨ Features

🚀 Installation

To get started with Softshell, ensure you have Rust and Cargo installed, then run:

cargo install softshell

Note on Glyphs: For the full visual experience with icons in your prompt, it is highly recommended to use a Nerd Font (e.g., Fira Code Nerd Font) in your terminal emulator.

⚙️ Configuration

Softshell is primarily configured via a Lua script. It will look for this file in several standard locations, prioritizing user-specific directories:

A comprehensive sample configuration, demonstrating prompt customization and custom commands, can be found on our GitHub repository. You can copy and modify this file to suit your needs.

📦 Lua Modules

Extend Softshell's functionality even further by writing your own Lua modules. Place these files in the directory specified by the modules_path variable in your config.lua file.

For instance, the Softhostname module (which helps resolve your hostname reliably) is a simple Lua file:

-- modules/softhostname.lua
local M = {}

function M.get_hostname()
    local host = os.getenv("HOSTNAME") or os.getenv("COMPUTERNAME")
    if host then
        return host
    end

    local cmd_output
    if package.config:sub(1,1) == "\\" then
        cmd_output = io.popen("hostname"):read("*l")
    else
        cmd_output = io.popen("hostname"):read("*l")
    end

    if cmd_output then
        return cmd_output:gsub("\n", "")
    end

    return "localhost"
end

return M

View the full source code for the Softhostname module on GitHub.

▶️ Usage

After installation, simply open your terminal and run:

sfsh

Once inside Softshell, you can execute system commands, or call custom Lua functions defined in your config.lua (e.g., try mycommands.hello() if you've included a similar function).

🤝 Contributing

We welcome contributions from the community! Whether you have an idea for a new feature, find a bug, or want to contribute code, please visit the GitHub repository to open an issue or submit a pull request.

⚖️ License

softshell (sfsh) is distributed under the terms of the Apache License, Version 2.0.

See the full Apache License 2.0 text for more details.