From 25cef3f8461a78714d01270e88b5e1c8f4fd7e3a Mon Sep 17 00:00:00 2001 From: savalet Date: Thu, 22 May 2025 21:10:04 +0200 Subject: [PATCH] Improve readme Upd readme Upd readme --- README.md | 138 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 102 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 1ded9b6..34ac741 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,103 @@ -- [x] `:` -- [x] `alias` -- [x] `astprint` -- [x] `builtins` -- [x] `cd`/`chdir` -- [x] `echo` -- [x] `env`/`setenv`/`unsetenv` (`env` Γ  completer) -- [x] `export` -- [x] `exit` -- [x] `printenv` -- [x] `pushd`/`popd` -- [x] `repeat` -- [x] `termname` -- [x] `which`/`where` -- [x] `yes` -- [x] `expr` +# 🐚 42sh – A Unix Shell Inspired by TCSH -- [x] pipes -- [x] redirections -- [x] line editing (move, del) -- [x] input shortcut (^A,^E,^F,^B,...) -- [x] foreground/background jobs (`&`), (btln `fg`) (bonus) -- [x] while/foreach loops -- [x] if -- [x] `||`/`&&` -- [x] script with shebangs -- [x] `-c` eval argument -- [x] `-e` exit on failure -- [x] `-h` help (open man?) -- [x] globbing -- [x] var interpreter -- [x] inhibitor -- [x] magic quotes -- [x] parenthesis -- [x] command history (`history` btln) -- [x] heredocs -- [x] special env vars: `$?`, `$$`, ... +**42sh** is a custom Unix shell written in C as part of the EPITECH curriculum. +Inspired by `tcsh`, this project aims to recreate a powerful, interactive command-line interface, complete with many built-in features, scripting capabilities, and user-friendly enhancements. + +## ✨ Features + +- **Built-in commands**: + - `cd`, `echo`, `exit`, `alias`, `setenv`, `unsetenv`, `env`, `printenv`, `which`, `where`, `repeat`, `yes`, `termname`, `expr`, and more... +- **Redirections**: + - Input/output redirection support: `>`, `<`, `>>`, `<<` (here-documents) +- **Pipelines**: + - Command chaining using pipes (`|`) +- **Globbing**: + - Wildcard expansion (`*`, `?`, etc.) +- **Job control**: + - Background job handling with `&` `fg` `bg` `Ctrl+Z` +- **History**: + - Command history navigation using arrow keys +- **Interractive reverse search**: + - Search in the history with `Ctrl+R` +- **Line editing**: + - Interactive line editing and cursor movement +- **Auto completion**: + - Interactive auto completion with `TAB` +- **Git integration**: + - Dynamic prompt with branch name, ahead and behind indicator +- **Alias system**: + - Define and expand custom aliases +- **Environment variables**: + - Manage the shell’s environment +- And more... + +## βš™οΈ Build & Run + +```bash +git clone https://github.com/Savapitech/42sh.git +cd 42sh +make +./42sh +``` +- Requires a POSIX-compliant system and a C compiler (tested with gcc on Linux). + +## πŸ“ Project Structure + +```txt +42sh/ +β”œβ”€β”€ include/ # Header files +β”œβ”€β”€ src/ # Shell source code +β”œβ”€β”€ ulib/ # Custom utility libraries +β”œβ”€β”€ validation_tests.py # Functional tests +β”œβ”€β”€ Makefile # Build system +└── README.md # You're reading it! +``` + +## 🧠 Concepts & Architecture + +- **Lexer/Parser**: Tokenizes user input into an Abstract Syntax Tree (AST) +- **Executor**: Traverses the AST to execute commands +- **Builtins**: Custom implementation of standard shell commands + +## πŸ§ͺ Testing + +You can run the test suite using: +```bash +make tests_run +``` +(Requires `python3`) + +## ❄️ Nix Support +This project provides full support for Nix: +- You can run the shell directly with: +```bash +nix run github:Savapitech/42sh +``` +- If you are working on the project, a development environment is available via the flake: +```bash +nix develop +``` +This gives you access to a reproducible devShell with all required dependencies. + + +## πŸ› οΈ Development Notes + +Written in **C99** + +Follows the **EPITECH coding style** + +No memory leaks (only if no errors occured) + +Handles signals (e.g., `Ctrl+C`, `Ctrl+D`) + +Compatible with **tcsh-style** interactive behavior + +## πŸ“œ License + +This project is part of the Epitech curriculum and is shared for educational purposes. + +## πŸ‘₯ Authors + +[@savalet](https://github.com/savalet), [@tekClovis](https://github.com/tekClovis), [@Arthur-gtr](https://github.com/Arthur-gtr), [@Titouanhct](https://github.com/Titouanhct), [@eiffis](https://github.com/eiffis) + +![CI](https://github.com/Savapitech/42sh/actions/workflows/main.yml/badge.svg)