-
Notifications
You must be signed in to change notification settings - Fork 3
Usage Examples
Shorky edited this page Jun 25, 2022
·
3 revisions
1- Add as a Dependency
# Start off by adding it as project dependency using your preferred package manger. (ig* npm, yarn, pnpm...)
# You can do so by opening your console & printing the following text:
npm install presentio
# or
yarn add presentio2- Initializing Presentio
// Import default fn from package
import Present from "presentio"
// Call fn passing it all necessary params
Present({
title: 'Title',
tagline: 'by @author',
description: 'An awesome description!',
version: '3-Mil',
// optional > fg: string, bg: string, clear: boolean
}, $helpMessage);
// ^ Msg to print upon use of help argument (ig* -h, --help)2.1- Presentio also includes a built-in fn to ease the process of creating a help message.
import Present, { helpTxt } from 'presentio';
const cliCmds = {
commands: {
prettify: 'add rainbows everywhere'
},
flags: {
rainbow: {
alais: 'r',
description: 'girl-in-red?',
default: false
}
}
}
Present({
... // same config as above
}, helpTxt(cliCmds));Expected output from: $ hyper -h/--help (using config from 2.1)
Title v$version by @author
An awesome description!
Usage:
$ title <commands> [options]
Commands:
<!-- cmd: description -->
prettify: add rainbows everywhere
Options:
<!-- alias, flag: description -->
-r, --rainbow: girl-in-red?
-h, --help: Print CLI's helpTxt <!-- Included by default -->
-v, --version: Print CLI's version <!-- Included by default -->