Check out the project report to learn more about our implementation.
- π¦ Prerequisites
- π Quick start
- π Makefile Guide
- π Project structure
- π List of insane livl-bash commands
- Working with the documentation
- π οΈ Pipelines
- π§π½Project team
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
To install the WSL on Windows, follow this tutorial.
Follow these steps to quickly get started:
-
Compile the Project: Run the
make
command. This will compile the project and create an executable file calledlivl-shell
in thebin
folder. -
Run the Executable: You can run the executable by using the command
./bin/livl-shell
ormake run
.
π Insane feature: You can run the executable in batch mode by using the command
./bin/livl-shell -c "ls -l"
.
- Clean the Project: Use the
make clean
command to clean the project.
π‘ Tip: The command
make run
will compile and immediately run the executable. It is equivalent to runningmake && ./bin/livl-shell
.
The project uses a Makefile for managing build tasks. Here are some of the available targets:
all
: Compile the project.run
: Run the executable.doc
: Generate documentation using Doxygen.gcov
: Generate code coverage data using gcov and lcov.package
: Package the project into a tar.gz file.clean
: Remove all object files.clean-gcov
: Remove all gcov-related files.mrproper
: Perform a deep clean of the project.clear
: Clear the console.
You can use the make help
command to display a brief description of each target.
The project is structured as follows:
livl-shell/
βββ bin/ # Contains the compiled binary
β βββ livl-shell # Executable
βββ doc/ # Contains the Doxygen documentation
β βββ html/
β βββ index.html
βββ gcov/ # Contains the coverage report
β βββ report/
β βββ index.html
βββ include/ # Contains the header files
β βββ file.h
| βββ ...
βββ src/ # Contains the source files
β βββ file.c
| βββ ...
βββ livl-shell.1 # Manual of the livl-shell
βββ index.html # Static Livl Shell website
βββ history.txt # History of your commands
βββ aliases.txt # List of aliases
βββ Makefile # Makefile
π‘ The livl-shell is limited to run a maximum of 3 commands in a row.
ls
: Lists the files in the current directory.cd
: Changes the current directory.pwd
: Prints the current directory.echo
: Displays a line of text.
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.cat << EOF
: let the user enter text until he types 'EOF' (You can change EOF by whatever you want). The text is then displayed on the screen thanks to the cat command.
ls -l | grep '.txt'
: Redirects the output of a command to another command. You can use single, double, or no quotes.
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. Thels -l
won't be executed because the shell is limited to run a maximum of 3 commands in a row.
β οΈ 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.
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
).
The livl-shell has an ex history feature that allows you to view the history of your commands.
Experimental: Use up / down and left / right arrows. To be able to use this feature, you need to go to the branch feat/history-navigation
. This feature is not available on the master
branch because some issues have been detected when using the left / right arrows to move the cursor in the command line and the up / down arrows to navigate through the history. But feel free to contribute to this branch if you want to fix this issue. π
The history is saved in the history.txt
file.
Livl-shell provide a basic alias support. Alias can be defined only by editing the aliases.txt
file. The syntax is the following:
alias_name="command"
Note that you can't use alias inside alias.
For example, if you want to create an alias for the ls -l
command, you can add the following line to the alias.txt
file:
ll="ls -l"
Then, you can run the ll
command to execute the ls -l
command.
You can input arguments with your alias, as well as use pipes and redirections. For example, if you input
ll -m
it will be interpreted asls -l -m
.
Command sequencing, pipes & redirections are not supported in aliases. Alias can only work for a single command.
To edit the man you can download a TROFF Syntax Highlighter for Visual Studio Code.
- The
man livl-shell
manual is located in thelivl-shell.1
file - To view the manual, run :
man ./livl-shell.1
β Doxygen is a documentation generator, a tool for writing software reference documentation.
- Download doxygen :
sudo apt install doxygen
- Run
make doc
to generate the documentation - To view the documentation, open the
index.html
file in thedoc/html/
folder.
β 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.
- Download gcov :
sudo apt install gcov
- Download lcov :
sudo apt install lcov
- 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
file in thegcov/report/
folder or rungcovr -r .
- Run
make clean-gcov
to clean thegcov
folder
Our pipelines are configured to be triggered on each push
and pull request
event on the master
branch. We have two main pipelines:
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/
The Livl team is composed of two members from the CNAM of Strasbourg:
@FranckG28 |
@jvondermarck |
---|---|
Franck Gutmann | Julien Von Der Marck |