Skip to main content

A feature-rich, customizable Unix shell with themes and job control

Project description

PhoenixNebula ๐Ÿš

A feature-rich, customizable Unix shell implementation written in Python with theme support, job control, and comprehensive command handling.

Python 3.11+ License: MIT PyPI version Code style: black

Features โœจ

  • Interactive Command Execution - Full support for executing system commands with proper I/O handling
  • Theme Support - 5 built-in themes (Dracula, Solarized Dark, Nord, Monokai, Gruvbox) plus custom themes
  • Job Control - Background and foreground job management with jobs, fg, and bg commands
  • Pipeline Support - Chain commands using the pipe operator (|)
  • Output Redirection - Redirect output and error streams to files (>, >>, 2>, 2>>)
  • Command Aliases - Create and manage command aliases
  • History Management - Full command history with persistence and custom history files
  • Tab Completion - Smart tab completion for commands and file paths
  • Signal Handling - Proper handling of SIGINT, SIGTSTP, SIGQUIT, and SIGWINCH
  • PTY Support - Interactive programs (vim, git, ssh, etc.) run with proper terminal control
  • Security - No external dependencies, safe input handling, no eval/exec

Installation ๐Ÿ“ฆ

Via pip (Recommended)

pip install phoenixnebula-cli
phoenixnebula

Via git + setup.py

git clone https://github.com/SysTechSalihY/phoenixnebula.git
cd phoenixnebula
sudo python3 setup.py install
phoenixnebula

Via Docker

docker pull nobodydeveloper/phoenixnebula:latest
docker run -it nobodydeveloper/phoenixnebula:latest

Binary Distribution ๐Ÿ› ๏ธ

PhoenixNebula can be distributed as a standalone binary, so users can run it without installing Python.

Build with PyInstaller (Recommended)

Install PyInstaller:

pip install pyinstaller
git clone https://github.com/SysTechSalihY/phoenixnebula.git
cd phoenixnebula
pyinstaller --onefile phoenixnebula/phoenixnebula.py
Run it directly: ./dist/phoenixnebula

### From source (Development)

```bash
git clone https://github.com/SysTechSalihY/phoenixnebula.git
cd phoenixnebula
pip install -e .
phoenixnebula

Quick Start ๐Ÿš€

Basic Commands

$ echo "Hello, World!"
Hello, World!

$ pwd
/home/user

$ cd Documents

$ ls -la

Background Jobs

Append & to run a command in the background:

$ sleep 100 &
[1] 12345

$ jobs
[1]  Running  sleep 100

$ fg %1

Piping Commands

$ cat file.txt | grep "search_term" | wc -l

Output Redirection

$ echo "text" > output.txt          # Write to file
$ echo "text" >> output.txt         # Append to file
$ command 2> errors.txt             # Redirect stderr
$ command 2>> errors.txt            # Append stderr

Themes

$ theme list
Available themes:
  - dracula *
  - nord
  - solarized_dark
  - monokai
  - gruvbox

$ theme set nord
Theme applied: Nord

Configuration ๐ŸŽจ

Shell Configuration File

Create ~/.phoenixnebularc for aliases and settings:

alias ll=ls -la
alias ..=cd ..
alias gs=git status
export PS1="\u@\h \w\$ "

Themes

PhoenixNebula comes with 5 built-in themes. Create custom themes at ~/.phoenixnebula/themes/mytheme.json:

{
  "name": "My Custom Theme",
  "background": "#1e1e1e",
  "foreground": "#e0e0e0",
  "cursor_color": "#e0e0e0",
  "black": "#000000",
  "red": "#ff0000",
  "green": "#00ff00",
  "yellow": "#ffff00",
  "blue": "#0000ff",
  "purple": "#ff00ff",
  "cyan": "#00ffff",
  "white": "#ffffff",
  "bright_black": "#808080",
  "bright_red": "#ff8080",
  "bright_green": "#80ff80",
  "bright_yellow": "#ffff80",
  "bright_blue": "#8080ff",
  "bright_purple": "#ff80ff",
  "bright_cyan": "#80ffff",
  "bright_white": "#ffffff",
  "prompt_user": "#00ff00",
  "prompt_host": "#00ffff",
  "prompt_path": "#ffff00",
  "prompt_symbol": "#ff00ff"
}

Then apply it:

$ theme set mytheme

Built-in Commands ๐Ÿ’ป

Navigation & Execution

Command Usage Description
cd cd [directory] Change current directory
pwd pwd Print working directory
echo echo [text] Print text to output
exit exit [code] Exit the shell
type type <command> Display command type
clear clear Clear terminal screen

Command History

Command Usage Description
history history [n] Show last n commands
history -r <file> Load history from file
history -w <file> Write history to file
history -a <file> Append history to file

Aliases

Command Usage Description
alias alias List all aliases
alias [name]=[value] alias ll='ls -la' Create alias
unalias unalias <n> Remove alias

Environment & Variables

Command Usage Description
export export VAR=value Set environment variable
unset unset VAR Unset environment variable
set set [VAR=value] Get/set shell variables

Job Control

Command Usage Description
jobs jobs List background jobs
fg fg %jobid Bring job to foreground
bg bg %jobid Resume job in background

Themes

Command Usage Description
theme theme Show available themes
theme list List all themes
theme set <n> theme set dracula Apply theme
theme current Show current theme

Advanced Features ๐Ÿ”ง

Pipeline Operations

Chain multiple commands with pipes:

$ cat data.txt | sort | uniq | wc -l

Variable Expansion

Expand environment variables:

$ echo $HOME
/home/user

$ echo ${PATH}
/usr/local/bin:/usr/bin:/bin

Tilde Expansion

Home directory shortcut:

$ cd ~/Documents
$ cat ~/.bashrc

Interactive Programs

The shell automatically detects and runs interactive programs with proper terminal control:

$ vim file.txt
$ git commit
$ python3

Security ๐Ÿ”’

  • No External Dependencies - Uses only Python standard library
  • Safe Input Handling - All input is validated and parsed safely using shlex
  • No Code Injection - Never uses eval(), exec(), or __import__()
  • Secure Variable Expansion - Variables are safely expanded with fallbacks
  • Signal Safety - Proper signal handling without race conditions
  • Process Isolation - Background jobs properly isolated using process groups

See SECURITY.md for detailed security information.

Testing ๐Ÿงช

Run the comprehensive test suite:

# Install test dependencies
pip install pytest pytest-cov

# Run all tests
pytest tests/ -v

# Run with coverage report
pytest tests/ -v --cov=phoenixnebula

# Run specific test class
pytest tests/test_phoenixnebula.py::TestSecurityInputValidation -v

Project Structure ๐Ÿ“

phoenixnebula/
โ”œโ”€โ”€ phoenixnebula/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ phoenixnebula.py
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_phoenixnebula.py
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ Dockerfile.prod
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ setup.py
โ”œโ”€โ”€ setup.cfg
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ MANIFEST.in
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ .gitignore

Keyboard Shortcuts โŒจ๏ธ

  • Ctrl+C - Cancel current command
  • Ctrl+Z - Suspend current command
  • Ctrl+D - Exit shell (EOF)
  • Tab - Auto-complete command or file path
  • Up/Down Arrows - Navigate command history
  • Ctrl+R - Reverse history search (if supported)

Environment Variables ๐ŸŒ

Variable Description
PATH Search path for executables
HOME User's home directory
HISTFILE Location of command history file
SHELL Current shell name
USER Current user name
HOSTNAME System hostname

Troubleshooting ๐Ÿ”ง

Shell Exits Unexpectedly

Check your ~/.phoenixnebularc file for errors:

cat ~/.phoenixnebularc

History Not Saving

Ensure the history file location is writable:

export HISTFILE=~/.phoenixnebula_history

Tab Completion Not Working

Verify Python readline module is available:

python3 -c "import readline; print('readline available')"

Interactive Programs Not Working Properly

Ensure your terminal emulator supports ANSI escape codes and PTY operations. Try clearing the screen:

clear

Theme Colors Not Applying

Try resetting the terminal:

reset
phoenixnebula

Contributing ๐Ÿค

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License ๐Ÿ“œ

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments ๐Ÿ™

  • Inspired by bash, zsh, and other Unix shells
  • Theme colors from popular terminal themes
  • Built with Python's standard library

Support ๐Ÿ’ฌ

For issues, questions, or suggestions:

  1. Check existing GitHub Issues
  2. Create a new issue with detailed description
  3. Submit a Pull Request with improvements

Security Policy ๐Ÿ”

If you discover a security vulnerability, please email salihyilboga98@gmail.com instead of using the issue tracker.


Enjoy using PhoenixNebula! ๐ŸŽ‰

For more information and advanced usage, visit the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phoenixnebula_cli-1.0.3.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phoenixnebula_cli-1.0.3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file phoenixnebula_cli-1.0.3.tar.gz.

File metadata

  • Download URL: phoenixnebula_cli-1.0.3.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for phoenixnebula_cli-1.0.3.tar.gz
Algorithm Hash digest
SHA256 51171526df72d10bf2dbedd2726ce68ffa51967980eac68bb630e22bc9b89560
MD5 ee2c9c1096f7b0b6e38b4ee58efcedf4
BLAKE2b-256 d7f08f6e91f4626f1b884e6d99d6b796c14b8b94a39457fa147a1c32bb9deb31

See more details on using hashes here.

File details

Details for the file phoenixnebula_cli-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for phoenixnebula_cli-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8783014c8c45619729e68993e70ea0406005a70fa76d63144ab222532ea66098
MD5 af35b5d24a2326ca5417833ad4d85061
BLAKE2b-256 148aa3ecb1342254e45d3df1efad4e70d3ed022376233caeb515c808d959fd8e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page