Update README.md With Detailed CLI Usage Examples And Theme Documentation

by ADMIN 74 views

Introduction

Welcome to our project, a powerful tool for generating plots from mathematical expressions. This README provides a comprehensive guide to using our CLI, including detailed examples and documentation of the new theme functionality. We will also cover diagnostic mode and provide an overview of our repository's mission.

Mission

Our mission is to provide a user-friendly and powerful tool for generating plots from mathematical expressions. We aim to make it easy for users to create high-quality plots with minimal effort.

Quick Start

To get started, simply run the following command:

node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.svg

This will generate a plot of the sine function over the range x = -1 to 1 and save it to output.svg.

CLI Usage Examples

CSV Output

To generate a CSV file containing the plot data, use the following command:

node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.csv --points 10

This will generate a CSV file with 10 points in the range x = -1 to 1.

PDF Output

To generate a PDF file containing the plot, use the following command:

node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.pdf

This will generate a PDF file with the plot.

SVG Output

To generate an SVG file containing the plot, use the following command:

node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.svg

This will generate an SVG file with the plot.

Theme Documentation

Our tool supports several themes, each with its own visual style. You can choose a theme using the --theme option.

Available Themes

  • dark: A dark theme with a black background and white text.
  • light: A light theme with a white background and black text.
  • blue: A blue theme with a blue background and white text.

Visual Changes

Each theme applies the following visual changes:

  • Background color
  • Marker color
  • Grid line color
  • Font family settings

Sample Command

To use the blue theme, run the following command:

node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.svg --theme blue

This will generate an SVG file with the plot using the blue theme.

Diagnostic Mode

To enable diagnostic mode, use the --diagnostics flag. This will output a JSON report with merged CLI and YAML configuration options plus environment details (current working directory, Node.js version, and platform).

Sample Command

To run the tool in diagnostic mode, use the following command:

node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.svg --diagnostics

This will output a JSON report with the diagnostic information.

Conclusion

We hope this updated README provides a guide to using our CLI. We strive to make our tool easy to use and provide high-quality documentation. If you have any questions or feedback, please don't hesitate to reach out.

Validation

Q: What is the purpose of the --expression option?

A: The --expression option is used to specify the mathematical expression to be plotted. For example, --expression "y=sin(x)" will plot the sine function.

Q: How do I specify the range of the plot?

A: You can specify the range of the plot using the --range option. For example, --range "x=-1:1" will plot the function over the range x = -1 to 1.

Q: Can I save the plot to a file?

A: Yes, you can save the plot to a file using the --file option. For example, --file output.svg will save the plot to a file named output.svg.

Q: What are the available themes?

A: The available themes are dark, light, and blue. Each theme applies a different visual style to the plot.

Q: How do I enable diagnostic mode?

A: You can enable diagnostic mode by using the --diagnostics flag. This will output a JSON report with merged CLI and YAML configuration options plus environment details.

Q: What is the purpose of the --points option?

A: The --points option is used to specify the number of points to plot. For example, --points 10 will plot 10 points in the range.

Q: Can I use multiple options together?

A: Yes, you can use multiple options together. For example, node src/lib/main.js --expression "y=sin(x)" --range "x=-1:1" --file output.svg --theme blue will plot the sine function over the range x = -1 to 1, save it to a file named output.svg, and use the blue theme.

Q: How do I get help with the CLI?

A: You can get help with the CLI by running node src/lib/main.js --help. This will output a list of available options and their descriptions.

Q: Where can I find more information about the project?

A: You can find more information about the project on our GitHub repository. We also have a MISSION.md file that outlines our mission and goals.

Q: How do I contribute to the project?

A: We welcome contributions to the project! You can submit issues or pull requests on our GitHub repository. We also have a CONTRIBUTING.md file that outlines our contribution guidelines.