3.0.0 • Published 9 months ago

@freephoenix888/generate-help-of-cli-apps-in-markdown-format v3.0.0

Weekly downloads
-
License
Unlicense
Repository
github
Last release
9 months ago

npm Gitpod

Generates help messages of CLI applications in markdown format in markdown format

Table Of Contents

Quick Start

  • Add the following to your README.md
    <!-- CLI_HELP_START -->
    <!-- CLI_HELP_END -->
  • Allow execution of your cli utilities. For example in bash you can do it like this
    find ./dist/cli/ -name "*.js" -exec chmod +x {} \;
  • Run this javascript code
import {readFileSync, writeFileSync} from 'fs';
import {generateHelpOfCliAppsInMarkdownFormat} from '@freephoenix888/generate-help-of-cli-apps-in-markdown-format';

const cliAppFilePaths = ['./dist/cli/name.js'/* You need to specify the paths here or get them from elsewhere. */]; // If you build your typescript files into dist/cli folder then you can use this code to get the paths: await glob(`./dist/cli/*.js`, {absolute: true})
const generatedHelpOfCliApps = generateHelpOfCliAppsInMarkdownFormat({
  cliAppFilePaths,
  output: {
    writeMode: 'replace-placeholder',
    placeholder: {
      start: `<!-- CLI_HELP_START -->`,
      end: `<!-- CLI_HELP_END -->`,
    },
    filePath: `./README.md`,
  }
});

Bash

Run this bash script

find ./dist/cli/ -name "*.js" -exec chmod +x {} \;
cli_help=$(npx --yes @freephoenix888/generate-help-of-cli-apps-in-markdown-format --cli-app-file-paths $(find ./dist/cli/*.js) --root-header-level 2)
pattern="(<!-- CLI_HELP_START -->)[\\S\\s]*(<!-- CLI_HELP_END -->)"
replacement=$'$1\n'"${cli_help}"$'\n$2'
npx --yes replace "$pattern" "$replacement" README.md

Library

Library Usage

See Documentation for examples and API

3.0.0

9 months ago

2.1.6

9 months ago

2.1.5

9 months ago

2.1.4

9 months ago

2.1.3

9 months ago

2.1.2

9 months ago

2.1.1

9 months ago

2.1.0

9 months ago

2.0.1

9 months ago

2.0.0

9 months ago

1.0.9

9 months ago

1.0.8

9 months ago

1.0.7

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago

0.0.1-dev.8

9 months ago

0.0.1-dev.7

9 months ago

0.0.1-dev.6

9 months ago

0.0.1-dev.3

9 months ago

0.0.1-dev.1

9 months ago

0.0.1-dev.0

9 months ago