Skip to content

Configure the CSV output with the m365 cli config set #2901

Description

@plamber

Usage

m365 cli config set --key seeBelow --value seeBelow

Description

Keep the original text

Options

Setting name Definition Default value
csvHeader Display the column names on the first line true
csvEscape Single character used for escaping; only apply to characters matching the quote and the escape options "
csvQuote The quote characters surrounding a field. An empty quote value will preserve the original field, whether it contains quotation marks or not.
csvQuoted Quote all the non-empty fields even if not required false
csvQuotedEmpty Quote empty strings and overrides quoted_string on empty strings when defined false

Additional Info

We recently introduced the CSV output for all our commands. This output is not configurable at this stage.

I want to provide some flexibility in configuring the output with a central config. The configuration of the CSV output can be done by using the options from https://csv.js.org/stringify/options/

  • header: Display the column names on the first line if the columns option is provided or discovered.
  • escape: Single character used for escaping; only apply to characters matching the quote and the escape options default to ".
  • quote: The quote characters surrounding a field defaults to the " (double quotation marks), an empty quote value will preserve the original field, whether it contains quotation marks or not.
  • quoted: Boolean, default to false, quote all the non-empty fields even if not required.
  • quotedEmpty: Quote empty strings and overrides quoted_string on empty strings when defined; default is false.

To implement the changes you have to:

  • implement the configuration in config-set.ts
  • write the tests under config-set.spec.ts
  • read the values from the config and set them in the CLI.ts
    return stringify(logStatement, {
  • write the tests in cli.spec.ts

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions