Skip to content

Commit

Permalink
docs: update github page + some readme improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jvondermarck authored Dec 29, 2023
2 parents 066d906 + f5be5d5 commit 24e49b8
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 176 deletions.
63 changes: 33 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<h1 align="center">
<img src="https://user-images.githubusercontent.com/62793491/208452652-71416c5c-8261-4501-a002-afc9e2cf0a0b.png" width="224px"/><br/>
<img src="https://user-images.githubusercontent.com/62793491/208452652-71416c5c-8261-4501-a002-afc9e2cf0a0b.png" width="224px"/>

<b>Livl Shell</b>
</h1>
<h4 align="center">
An Intermediate Reimplementation of the Bash Shell in C
</h4>

# Table of Contents
## Table of Contents

- [📦 Prerequisites](#-prerequisites)
- [🚀 Quick start](#-quick-start)
- [📚 Makefile Guide](#-makefile-guide)
Expand All @@ -30,16 +32,18 @@
- [2. Static Pipeline](#2-static-pipeline)
- [🧍🏽Project team](#-project-team)

# 📦 Prerequisites
## 📦 Prerequisites

This project is developed in C language, so you need to have a C compiler installed on your machine. It would be better to run it on a Linux distribution, but it is possible to run it on Windows with the WSL (Windows Subsystem for Linux).
This project is developed in C language, so you need to have a C compiler installed on your machine to build it.
It would be better to run it on a Linux distribution, but it has also been tested on macOS.
It is possible to run it on Windows with the WSL (Windows Subsystem for Linux).

- `gcc` : `sudo apt install gcc`
- `make`: `sudo apt install make`
- gcc : `sudo apt install gcc`
- make: `sudo apt install make`

> To install the WSL on Windows, follow this [tutorial](https://docs.microsoft.com/en-us/windows/wsl/install-win10).
# 🚀 Quick start
## 🚀 Quick start

Follow these steps to quickly get started:

Expand All @@ -53,7 +57,7 @@ Follow these steps to quickly get started:

> 💡 **Tip**: The command `make run` will compile and immediately run the executable. It is equivalent to running `make && ./bin/livl-shell`.
# 📚 Makefile Guide
## 📚 Makefile Guide

The project uses a Makefile for managing build tasks. Here are some of the available targets:

Expand All @@ -69,7 +73,7 @@ The project uses a Makefile for managing build tasks. Here are some of the avail

You can use the `make help` command to display a brief description of each target.

# 📁 Project structure
## 📁 Project structure

The project is structured as follows:

Expand All @@ -95,84 +99,83 @@ livl-shell/
└── Makefile # Makefile
```

# 📝 List of Insane livl-bash Commands
## 📝 List of Insane livl-bash Commands

> 💡 The livl-shell is limited to run a maximum of 3 commands in a row.
## Basic Commands
### Basic Commands

- `ls`: Lists the files in the current directory.
- `cd`: Changes the current directory.
- `pwd`: Prints the current directory.
- `echo`: Displays a line of text.

## Input/Output Redirection
### Input/Output Redirection

- `ls -l > output.txt`: Redirects the output of a command to a file.
- `pwd >> output.txt`: Appends the output of a command to a file.
- `wc -l < output.txt`: Counts the number of lines in the file.

## Pipelines
### Pipelines

- `ls -l | grep '.txt'`: Redirects the output of a command to another command. You can use single, double, or no quotes.

## Command Sequencing
### Command Sequencing

- `sleep 4 && echo "Second command executed"`: Executes a command after another one.
- `false && echo "This won't be executed"`: Executes a command after another one only if the first one succeeded.
- `false || echo "This will be executed"`: Executes a command after another one only if the first one failed.
- `echo "Command 1"; sleep 3; echo "Command 2"; ls -l`: Executes multiple commands regardless of the success of the previous ones.

## Batch Mode
### Batch Mode

> ⚠️ The command should be enclosed in quotes to ensure it is passed as a single argument
- `./livl-shell -c "ls -l|grep txt && echo heyyy"`: Executes a list of commands from the command line.
- `./livl-shell --command "echo livl"`: Executes a list of commands from the command line.

## Background Execution
### Background Execution

- `sleep 3 & echo hey`: Executes a command in the background (the shell will not wait for the command to finish) and it will show you the job id of the background process (ex: `[1] 1234`).
- `pwd`: Running this command will display the job id of the background process terminated (ex: `[1] done sleep 3`).

- `pwd`: Running this command will display the job id of the background process terminated (ex: `[1] done sleep 3`).

# 📖 Use the livl-bash `man` command
## 📖 Use the livl-bash `man` command

> To edit the man you can download a TROFF Syntax Highlighter for Visual Studio Code.
- The `man livl-shell` manual is located in the [`livl-shell.1`](livl-shell.1) file
- To view the manual, run : `man ./livl-shell.1`

# 📜 Doxygen documentation
## 📜 Doxygen documentation

> ❓ Doxygen is a documentation generator, a tool for writing software reference documentation.
## 📦 Prerequisites of Doxygen
### 📦 Prerequisites of Doxygen

- `Download doxygen` : `sudo apt install doxygen`
- Download doxygen : `sudo apt install doxygen`

## 🚀 Generate the Doxygen documentation
### 🚀 Generate the Doxygen documentation

- Run `make doc` to generate the documentation
- To view the documentation, open the [`index.html`](/doc/html/index.html) file in the `doc/html/` folder.

# 🧪 GCOV test coverage
## 🧪 GCOV test coverage

> ❓ GCOV is a test coverage program. It helps you determine how much of your source code is being tested by your test suite. It is a useful tool for finding untested code.
## 📦 Prerequisites of gcov
### 📦 Prerequisites of gcov

- `Download gcov` : `sudo apt install gcov`
- `Download lcov` : `sudo apt install lcov`
- Download gcov : `sudo apt install gcov`
- Download lcov : `sudo apt install lcov`

## 🚀 Generate the coverage report
### 🚀 Generate the coverage report

- Run `make gcov` to generate the coverage report
- To exit the coverage report, press `exit` two times (one for the shell and one for the coverage report)
- To view the coverage report, open the [`index.html`](/gcov/report/index.html) file in the `gcov/report/` folder or run `gcovr -r .`
- Run `make clean-gcov` to clean the `gcov` folder

# 🛠️ Pipeline
## 🛠️ Pipeline

Our pipelines are configured to be triggered on each `push` and `pull request` event on the `master` branch. We have two main pipelines:

Expand All @@ -185,7 +188,7 @@ The `c-make` pipeline compiles the project using the `make` command.
The `static` pipeline hosts the static website on GitHub Pages at the root of the repository. This allows access to the Doxygen documentation and the Coverage report at the following address: https://livl-corporation.github.io/livl-shell/


# 🧍🏽Project team
## 🧍🏽Project team

The Livl team is composed of two members from the CNAM of Strasbourg:

Expand Down
22 changes: 11 additions & 11 deletions include/history_command.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @file history_command.h
* @author Julien & Franck
* @date 24 Dec 2023
* @brief File containing the history command functions to manage the history of commands entered by the user (saving, loading, etc.) to a file.
* @brief File containing the functions to manage (load & save, etc.) the history of commands entered by the user to a file.
*/
#ifndef HISTORY_COMMAND_H
#define HISTORY_COMMAND_H
Expand All @@ -14,50 +14,50 @@

/**
* @brief The max size of the history
*/
*/
#define MAX_HISTORY_SIZE 1000

/**
* @brief The history file name
*/
*/
#define HISTORY_FILE "history.txt"

/**
* @brief The global history of commands entered by the user
*/
*/
extern CommandHistory global_command_history;

/**
* @brief Initialize the global command history
*/
*/
void initialize_command_history();

/**
* @brief Add a command to the global command history
* @param command The command to be added
*/
*/
void add_to_command_history(const char *command);

/**
* @brief Get the previous command from the global command history
* @return The previous command
*/
*/
const char *get_previous_command();

/**
* @brief Get the next command from the global command history
* @return The next command
*/
*/
const char *get_next_command();

/**
* @brief Save the command history to the history file
*/
*/
void save_command_history_to_file();

/**
* @brief Load the command history from the history file
*/
*/
void load_command_history_from_file();

#endif //HISTORY_COMMAND_H
#endif // HISTORY_COMMAND_H
14 changes: 7 additions & 7 deletions include/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@

/**
* @brief The child process id (pid)
*/
*/
#define CHILD_PROCESS 0

/**
* @brief Executes a command
* @brief Executes an external command
* @param command The command to execute
* @param run_in_background 0 for false, 1 for true
* @return The status of the execution
*/
*/
int execute_external_command(const Command *command, int run_in_background);

/**
* @brief Executes a command
* @brief Executes a command internal to the shell
* @param command The command to execute
* @param run_in_background 0 for false, 1 for true
* @return The status of the execution
*/
*/
int execute_command(const Command *command, int run_in_background);

/**
* @brief Executes a sequence of commands with operators
* @param sequence The sequence of commands to execute
* @return The status of the execution
*/
*/
int execute_command_sequence(const CommandSequence *sequence);

#endif //SCHEDULER_H
#endif // SCHEDULER_H
Loading

0 comments on commit 24e49b8

Please sign in to comment.