diff --git a/rust-code-analysis-book/src/commands/metrics.md b/rust-code-analysis-book/src/commands/metrics.md index 94ec98897..55a70b30b 100644 --- a/rust-code-analysis-book/src/commands/metrics.md +++ b/rust-code-analysis-book/src/commands/metrics.md @@ -1,54 +1,45 @@ # Metrics -Metrics can be printed on screen or exported as different output formats -through **rust-code-analysis-cli**. +Metrics can be displayed or exported in various formats using the **rust-code-analysis-cli**. -## Print metrics +## Display Metrics -For each function space, **rust-code-analysis** computes the list of metrics -described above. At the end of this process, **rust-code-analysis-cli** -dumps the result formatted in a certain way on the screen. -The command used to print the metrics is the following one: +To compute and display metrics for a given file or directory, run: -```console +```bash rust-code-analysis-cli -m -p /path/to/your/file/or/directory ``` -The `-p` option represents the path to a file or a directory. If a directory is -passed as input, **rust-code-analysis-cli** computes the metrics for each file -contained in it. +- `-p`: Path to the file or directory to analyze. If a directory is passed, metrics will be computed for all supported files within. -## Export formats +## Exporting Metrics -Different output formats can be used to export metrics: +The **rust-code-analysis-cli** supports multiple output formats for exporting metrics, including: -- Cbor -- Json -- Toml -- Yaml +- CBOR +- JSON +- TOML +- YAML -`Json` and `Toml` can also be exported pretty-printed. +Both `Json` and `Toml` can be exported as pretty-printed. -### Export command +### Export Command -For example, if you want to export metrics as a `json` file, run: +To export metrics as a JSON file: -```console -rust-code-analysis-cli -m -O json -o /output/path -p /path/to/your/file/or/directory +```bash +rust-code-analysis-cli -m -p /path/to/your/file/or/directory -O json -o /path/to/output/directory ``` -The `-O` option allows you to choose the output format. It supports -**only** these values: *cbor*, *json*, *toml*, *yaml*. +- `-O`: Specifies the output format (e.g., json, toml, yaml, cbor). +- `-o`: Path to save the output file. If not specified, the result will be printed in the shell. -The `-o` option is used to specify the path where your file will be saved. -It accepts **only** paths. The filename of your output file is the same as -your input file plus the extension associated to the format. When this option -is not given, the output is printed on shell. +## Pretty Print -As we said before, `Json` and `Toml` can be exported as pretty-printed. To do -so, the `--pr` option is used. -In the case below, the pretty-printed `json` output will be printed on shell: +To output pretty-printed JSON metrics: -```console -rust-code-analysis-cli -m -O json --pr -p /path/to/your/file/or/directory +```bash +rust-code-analysis-cli -m -p /path/to/your/file/or/directory --pr -O json ``` + +This command prints the formatted metrics to the console or the specified output path.