From 86355a6fd7375f954bf92cb49a14c718610c4d60 Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Fri, 26 Feb 2021 15:55:26 +0100 Subject: Added command line argument documentation draft --- README.md | 12 ++++----- docs/index.rst | 6 +++-- docs/options.rst | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ minishell_test/config.py | 7 ++--- 4 files changed, 81 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 4732b84..41cdc4b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# minishell test [![Build Status](https://api.travis-ci.com/cacharle/minishell_test.svg?branch=master)](https://travis-ci.com/cacharle/minishell_test) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/minishell-test)](https://pypi.org/project/minishell-test/) +# minishell test [![Build Status](https://api.travis-ci.com/cacharle/minishell_test.svg?branch=master)](https://travis-ci.com/cacharle/minishell_test) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/minishell-test)](https://pypi.org/project/minishell-test/) [![Documentation](https://readthedocs.org/projects/minishell-test/badge/?version=latest)](https://minishell-test.readthedocs.io) Test for the minishell project of school 42. @@ -75,20 +75,20 @@ $ ./minishell -c 'ls' README.md test.sh ``` -With this setup `argv[2]` is what you would usually get in `line` from `get_next_line`. +With this setup `argv[2]` is what you would usually get in `line` from `get_next_line`. This allows you to set the prompt to whatever you want. ### Environement variables -My test only gives the `PATH` and `TERM` environment variables to your minishell. -**Please check that your project still work with those settings before messaging me on Slack or creating an issue**. +My test only gives the `PATH` and `TERM` environment variables to your minishell. +**Please check that your project still work with those settings before messaging me on Slack or creating an issue**. You can test this quickly with the `-t` option (e.g `minishell_test -t 'echo bonjour`). ## Bonus * Force the bonus tests with `$ minishell_test -b` * Change the `BONUS` variable in [config.py](minishell_test/config.py) to True -* Set the environment variable `MINISHELL_TEST_BONUS` to `yes` +* Set the environment variable `MINISHELL_TEST_BONUS` to `yes` (e.g `echo 'export MINISHELL_TEST_BONUS=yes' >> ~/.zshrc`) ## Memory leaks @@ -99,7 +99,7 @@ to select the tests to run since valgrind is really slow. ## Don't check error messages If you don't want to copy bash syntax error message, -you can set the environment variable `MINISHELL_TEST_DONT_CHECK_ERROR_MESSAGE` to `yes`. +you can set the environment variable `MINISHELL_TEST_DONT_CHECK_ERROR_MESSAGE` to `yes`. It will still test your exit status code but will discard any output on error tests. ## Linux diff --git a/docs/index.rst b/docs/index.rst index 109963f..7726f0a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,3 +1,5 @@ +.. program:: minishell_test + minishell_test ============== @@ -72,10 +74,10 @@ Environement variables This test only gives the ``PATH`` and ``TERM`` environment variables to your minishell by default (see :ref:`config env`). -You can test this quickly with the `-t` option (See :ref:`options try`). +You can test this quickly with :option:`--try`. .. warning:: - Please check that your project still work with those settings before creating an issue or messaging me on. + Please check that your project still work with this environment before creating an issue or messaging me on Slack. Bonus ----- diff --git a/docs/options.rst b/docs/options.rst index 56a8c55..7c29529 100644 --- a/docs/options.rst +++ b/docs/options.rst @@ -1,2 +1,71 @@ Command line Options ==================== + +.. code-block:: txt + + usage: minishell_test [-h] [-p PATH] [-l] [-t COMMAND] [-k] [-r BEGIN END] + [--show-range] [-x] [-v] [-b] [-n] [-m] [-g] + [suite ...] + +.. program:: minishell_test + +.. option:: suite + + Test suites/group to run. + It tries to be smart and autocomplete the suite name + (e.g ./run int -> ./run preprocess/interpolation) + + +.. option:: -h, --help + + show this help message and exit + +.. option:: -p , --path + + Path to minishell directory + +.. option:: -l, --list + + Print available test suites + +.. option:: -t , --try + + Run a custom command like this test would + (the only environment variable passed to your executable are TERM and PATH) + +.. option:: -k, --check-leaks + + Run valgrind on tests (disable usual comparison with bash) + +.. option:: -r , --range + + Range of test index to run (imply --show-index) + +.. option:: --show-range + + Show test index (useful with --range) + +.. option:: -x, --exit-first + + Exit on first fail + +.. option:: -v, --verbose + + Increase verbosity level (e.g -vv == 2) + +.. option:: -b, --bonus + + Enable bonus tests + +.. option:: -n, --no-bonus + + Disable bonus tests + +.. option:: -m, --make + + Make minishell and exit + +.. option:: -g, --pager + + After running the test, display the result in a pager of your choice + diff --git a/minishell_test/config.py b/minishell_test/config.py index ac5b3ca..1d471c9 100644 --- a/minishell_test/config.py +++ b/minishell_test/config.py @@ -1,18 +1,15 @@ # ############################################################################ # # # # ::: :::::::: # -# config.py :+: :+: :+: # +# defaults.py :+: :+: :+: # # +:+ +:+ +:+ # # By: charles +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2020/07/15 18:24:19 by charles #+# #+# # -# Updated: 2021/02/24 07:50:26 by cacharle ### ########.fr # +# Updated: 2021/02/26 09:40:07 by cacharle ### ########.fr # # # # ############################################################################ # -################################################################################ -# Minishell configuration file # -################################################################################ import os import shutil -- cgit