Socket
Socket
Sign inDemoInstall

doccl

Package Overview
Dependencies
2
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    doccl

documentation first cli tools


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

doccl

documentation first cli tools.

Usage

For an example markdown file contents, and further usage docs, read over test.js.

const doccli = require('doccli');
const { readFileSync } = require('fs');

const md = readFileSync('path.md', {
  encoding: 'utf8'
});

const argv = process.argv.slice(2)

const $ = doccli(argv, md);

// $ variable now holds a getter function for
// values along with common tools used when
// writing cli interfaces. see below.

Getter Function

The default return of doccli is a getter function used as such:

$(string | number)

If a string is provided, it will search for flags (and aliases) with the given string and return it's value. If a number is provided, it will instead return the value of the positional argument.

CLI helpers

In addition to the argument fetching, a very minimal set of functions & getters have been attached to the $ object:

Arguments

  • $.all - An object containing all the arguments given.
  • $.pos - An array containing all the positional arguments given.

IO

  • $.cout() - Alias for console.log, chainable.
  • $.cerr() - Alias for console.error, chainable.
  • $.out - Alias for process.stdout
  • $.err - Alias for process.stderr

Assert

  • $.assert

Exports Node's assert library to this variable. Useful for argument checking, argument lengths, etc.

Misc.

  • $.exit() - Alias for process.exit

FAQs

Last updated on 05 Dec 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc