Skip to content

3. Command Line

Tom Chapman edited this page Dec 14, 2022 · 3 revisions

Project information

BooleanExpressionParser.CLI is the project home to the command line interface. It uses System.CommandLine for argument parsing and Spectre.Console for coloured output. It relies upon BooleanExpressionParser for functionality.

Status

The CLI is mostly feature-complete. So far, it implements truth table generation and notation conversion. Single value evaluation will come eventually.

Base command

./BooleanExpressionParser [command] [options]

Options

  • -o, --output, --output-type <Basic|Display> The output type to use.

Truth table generation

Prints the truth table of a boolean expression(s). If none are provided, the user will be prompted to enter them.

Usage

./BooleanExpressionParser table [<expression(s)>...] [options]

Arguments

  • <expression(s)> The boolean expression(s) to evaluate.

Options

  • -t, --true <true> Character to use for true values in the truth table. [default: 1]
  • -f, --false <false> Character to use for false values in the truth table. [default: 0]
  • -c, --colour-mode, --color-mode <Background|Foreground|None> Colour mode to use for the truth table. [default: Foreground] (possible values: [Ff]oreground, [Bb]ackground, [Nn]one)
  • --true-colour, --true-color <true-colour> Colour to use for true values in the truth table. [default: green] (possible values: 16 ANSI colours, hex string, rgb string)
  • --false-colour, --false-color <false-colour> Colour to use for false values in the truth table. [default: red] (possible values: 16 ANSI colours, hex string, rgb string)

Screenshot

Sample screenshot of a truth table output

Notation conversion

Converts a boolean expression(s) to postfix notation. If none are provided, the user will be prompted to enter them.

Usage

./BooleanExpressionParser convert [<expression(s)>...] [options]

Arguments

  • <expression(s)> The boolean expression(s) to convert

More commands to be implemented in the future.

For help, run ./BooleanExpressionParser --help. For help with a specific command, run ./BooleanExpressionParser [command] --help or ./BooleanExpressionParser --help [command].