Skip to content

Expose CLI API to execute commands #2996

@waldekmastykarz

Description

@waldekmastykarz

To allow integrating CLI for Microsoft 365 in other tools we should export CLI's API for executing commands in the CLI's npm package. This will allow other tools that want to use CLI get a direct access to the API and not need to rely on executing CLI as a child process and interact with it through stdout, stderr and exit codes. When you install CLI for M365 as a dependency in your Node.js project, you should be able to do import { executeCommandWithOutput } from '@pnp/cli-microsoft365 and use the executeCommandWithOutput function to execute the specified command with its arguments and capture its output.

After we add this, we should also add a new page about integrating CLI in other tools in our documentation.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions