A lightweight, feature-rich shell implemented in Python, designed to mimic the functionality of traditional Unix shells like bash or zsh, with additional advanced features and a GUI interface.
-
Command Execution:
- Execute system commands like
ls,pwd,echo, and more. - Supports commands with arguments (e.g.,
ls -l /home).
- Execute system commands like
-
I/O Redirection:
- Output redirection:
command > file.txt - Input redirection:
command < file.txt - Append mode:
command >> file.txt - Error redirection:
command 2> error.log
- Output redirection:
-
Pipe Support:
- Chain multiple commands using
|(e.g.,ls | grep .py).
- Chain multiple commands using
-
Process Management:
- Run commands in the background using
&(e.g.,sleep 5 &). - Track and manage background processes.
- Run commands in the background using
-
Built-in Commands:
cd: Change directories.pwd: Print the current working directory.ls: List files in the directory.echo: Print text to the terminal or redirect output to a file.history: View previously entered commands.exit: Quit the shell.
-
Command History:
- View and reuse previously entered commands.
-
Custom Prompt:
- Displays user info, hostname, and the current working directory.
- Example:
[user@host:/home]$
-
Dark Theme:
- Aesthetic and user-friendly terminal appearance.
-
Color Support:
- Uses ANSI color codes for syntax highlighting and UI customization:
ANSI_COLORS = { '30': '#000000', # Black '31': '#FF0000', # Red '32': '#00FF00', # Green '33': '#FFFF00', # Yellow '34': '#0000FF', # Blue '35': '#FF00FF', # Magenta '36': '#00FFFF', # Cyan '37': '#FFFFFF', # White }
- Uses ANSI color codes for syntax highlighting and UI customization:
-
Scrollable Output:
- Allows viewing extensive outputs from commands.
-
Command Input Area:
- A text box for entering shell commands.
-
Output Display:
- Scrollable area to view command outputs.
-
Status Bar:
- Displays process status and shell information.
-
Syntax Highlighting:
- Highlight keywords, commands, and errors for better visibility.
-
Clone the repository:
git clone https://github.com/Ali-Beg/pyAlx.git cd pyAlx -
Install dependencies:
pip install -r requirements.txt
- CLI Mode:
python main.py
- GUI Mode:
python main.py --gui
| Command | Description |
|---|---|
cd /path/to/dir |
Navigate to the specified directory. |
pwd |
Print the current working directory. |
ls |
List files in the current directory. |
echo "text" |
Print text to the console or a file. |
command > file |
Redirect command output to a file. |
command & |
Run a command in the background. |
history |
View previously entered commands. |
exit |
Exit the shell. |
-
Pipelines:
- Chain commands using pipes (
|), e.g.,ls | grep .py.
- Chain commands using pipes (
-
Error Handling:
- Redirect errors to a file using
2>, e.g.,command 2> error.log.
- Redirect errors to a file using
-
Background Processing:
- Run processes in the background with
&.
- Run processes in the background with
- Run all tests:
pytest tests/ -v
- Check code coverage:
pytest tests/ --cov=src
- GUI text selection is limited.
- History navigation has edge cases.
- Handling complex pipe chains is still under development.
- Command aliases (e.g.,
llforls -l). - Shell scripting capabilities.
- Auto-suggestions for commands and arguments.
- Multi-tab GUI for running parallel sessions.
- Plugin system for extensibility.
- Configuration files for customization.
- Fork the repository:
git clone https://github.com/Ali-Beg/pyAlx.git
- Create a feature branch:
git checkout -b feature-name- Follow code style guidelines and write tests for new features.
- Submit a pull request with detailed explanations.
This project is open-source under the MIT License.
Your Name
Contact: mber937@gmail.com
Feel free to reach out for suggestions, feedback, or contributions!
Special thanks to all contributors and the open-source community for inspiration and support!