Skip to content
/ 2pre Public

CLI that converts a code snippet to md table embeddable <pre> one-liner

Notifications You must be signed in to change notification settings

lxgreen/2pre

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

2pre

converts a code snippet to md table embeddable <pre> one-liner

oclif Version CircleCI Codecov Downloads/week License

Usage

$ npm install -g 2pre

$ 2pre --help
USAGE
  $ 2pre FILE

ARGUMENTS
  FILE  file to convert

OPTIONS
  -h, --help             show CLI help
  -t, --tabsize=tabsize  [default: 2] tab size
  -v, --version          show CLI version

Example

$ 2pre ./test/test.js
  async run() {
    const { args } = this.parse(_2Pre);
    if (!existsSync(args.file)) {
      throw new Error("Please provide valid file path");
    }
    const code = readFileSync(args.file).toString();
    this.log(code);
    const converted = _2Pre.convertCode(code);
    this.log(converted);
  }

<pre>&nbsp;async run() {<br/>&nbsp;&nbsp;const { args } = this.parse(_2Pre);<br/>&nbsp;&nbsp;if (!existsSync(args.file)) {<br/>&nbsp;&nbsp;&nbsp;throw new Error("Please provide valid file path");<br/>&nbsp;&nbsp;}<br/>&nbsp;&nbsp;const code = readFileSync(args.file).toString();<br/>&nbsp;&nbsp;this.log(code);<br/>&nbsp;&nbsp;const converted = _2Pre.convertCode(code);<br/>&nbsp;&nbsp;this.log(converted);<br/>&nbsp;}<br/></pre>

About

CLI that converts a code snippet to md table embeddable <pre> one-liner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published