3.0.1 • Published 5 years ago

defence-cli v3.0.1

Weekly downloads
70
License
MIT
Repository
github
Last release
5 years ago
npm install --global defence-cli

Filter a README file, retaining fenced code blocks with JavaScript code, piping to Node.js for execution:

defence --info javascript,js README.md | node

Along with assert and replace-require-self, this can make for very readable npm test scripts that run code examples in your README files:

{
  "scripts": {
    "test": "defence README.md | replace-require-self | node"
  }
}

boolean-json-cnf is an example.

Without a file argument, read from standard input:

cat README.md | defence --info javascript,js | node

Retain just fenced code blocks without info strings:

cat INSTALLING.md | defence --no-info | less

Source lines outside of matching fenced code blocks are retained as blank lines, so line numbering doesn't change:

echo "\n\n\n\n\n~~~js\nthrow new Error()\n~~~" | defence | node
[stdin]:7
throw new Error()
      ^
Error
    at [stdin]:7:7
	[ ... ]
3.0.1

5 years ago

3.0.0

5 years ago

2.0.1

8 years ago

2.0.0

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

9 years ago

1.0.0

9 years ago