Skip to content

Run a CLI command and capture output for Markdown #710

@joelverhagen

Description

@joelverhagen

I am not certain if a PR for this proposal will be accepted.

Is the feature request related to a problem

In Markdown document for CLI tools, I would like to show sample output from CLI command.

For example, if my repo is a CLI tool I may want to show the list of options by putting the latest content of dotnet run -- --help into my Markdown in the place of a snippet placeholder.

Describe the solution

The snippet placeholder could have the format cli: <CLI command> like this:

See the tool's help text below for a full description of all options.
snippet: cli: dotnet run -- --help

Or perhaps cli-snippet: dotnet run -- --help

The output would be wrapped in

```plaintext

This is kind of like the http snippets except the content is fetched locally instead of from a remote server.

Describe alternatives considered

  • Manually update the Markdown with the help text -- this is error-prone since I often forget to update the Markdown so the README ends up being stale.
  • Write my own tool with much of the same common infrastructure as MarkdownSnippets

Additional context

Here is a sample README of mine with help text:
https://github.com/joelverhagen/PackageLifeCycle?tab=readme-ov-file#help-text

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions