https://github.com/omrilotan/man
📖 Print contents of package man file in console
https://github.com/omrilotan/man
cli man manual npm package-json
Last synced: about 2 months ago
JSON representation
📖 Print contents of package man file in console
- Host: GitHub
- URL: https://github.com/omrilotan/man
- Owner: omrilotan
- License: mit
- Created: 2020-01-27T20:37:50.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-01-27T21:53:30.000Z (over 6 years ago)
- Last Synced: 2025-04-01T18:53:13.222Z (about 1 year ago)
- Topics: cli, man, manual, npm, package-json
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# man
## 📖 Print contents of package man file in console
### CLI
```bash
$ npx man
# or
$ manfile
# or
$ manual
```
### Package
```js
const man = require('man');
const [, , ...rest] = process.argv;
if (rest.includes('--help') || rest.includes('-h')) {
await man({ exit: true });
}
```
> - Uses console.info to print
> - Module function returns the contents
Example: Using Yargs parser
```js
const parser = require('yargs-parser');
const man = require('man');
const args = parser(
process.argv.slice(2),
{
alias: {
help: [ 'h' ]
}
}
);
args.help
? man()
: runApp(args)
;
```
#### Arguments
##### exit
Whether to exit the process after finished. Defaults to `false`
```js
man({ exit: true })
```
##### print
Whether to print the contents of man file. Defaults to `true`
```js
man({ print: false })
```
##### base
Root from which to look for package.json and man files. Defaults to `process.cwd()`
```js
man({ base: '/home/app' })
```