Nostalgic Punchcard Missing
    Have ideas to improve npm?Join in the discussion! »

    beame-cli

    0.0.4 • Public • Published

    Intro

    This is CLI framework for Beame products. Currently it's in early stages so using it for your products is not advisable. We do expect that beame-cli will become usable to others as it matures. Documentation will be improved later.

    Sample usage

    const parametersSchema = {
    	'format': {required: false, options: ['text', 'json'], default: 'text'},
    };
    
    const BeameCli = require('beame-cli');
    const cli = new BeameCli('YOUR_SCRIPT_NAME_FOR_USAGE_EXAMPLES', 'DIR_WITH_FILES_FOR_CLI', [
    	'NAMES_OF_FILES',
    	'WITHOUT_DOT_JS'
    ]);
    
    cli.setGlobalSchema(parametersSchema);
    
    cli.approveCommand = (cmdName, subCmdName) => {
    	if((cmdName == 'creds') && (subCmdName == 'getCreds')) {
    		return true;
    	}
    	var credsCount = list().length;
    
    	if (!credsCount) {
    		console.log(getHelpMessage('no-certificates.txt'));
    		return false;
    	}
    	return true;
    };
    
    cli.usage = () => {
    	console.log(getHelpMessage('no-command.txt'));
    };
    
    cli.run();
    

    DIR_WITH_FILES_FOR_CLI contents

    There should be *.js files, each one containing functions to handle one sub-command.

    ...
    function getCreds(regToken, callback) {
    	callback
    }
    
    getCreds.params = { 'regToken': {required: true, base64: true, json: true} }
    ...
    

    Sample output

    ./main.js
    Usage:
      beame-gatekeeper creds getCreds --regToken regToken
      beame-gatekeeper creds list [--regex regex] [--format {text|json}]
      beame-gatekeeper creds createServersCredentials
      beame-gatekeeper creds webToken --type {config|admin|app} [--appId appId] [--format {text|json}]
      beame-gatekeeper config init
      beame-gatekeeper config name --name name
      beame-gatekeeper config setAuthServer --fqdn fqdn
      beame-gatekeeper config apps
      beame-gatekeeper server start
    

    Keywords

    Install

    npm i beame-cli

    DownloadsWeekly Downloads

    5

    Version

    0.0.4

    License

    MIT

    Unpacked Size

    8.33 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar
    • avatar
    • avatar
    • avatar