1.0.1 • Published 4 years ago

automizely-cli v1.0.1

Weekly downloads
-
License
none
Repository
github
Last release
4 years ago

Automizely CLI

A collection of tools for Automizely

Usage

Setup SSH for connecting to Github, see the setting guide

Install

Install via npm

npm install automizely-cli -g

Or yarn

yarn add automizely-cli --global

Main commands

Usage: am-cli <command> [options]
    ___         __                  _            __
   /   | __  __/ /_____  ____ ___  (_)___  ___  / /_  __
  / /| |/ / / / __/ __ \/ __ `__ \/ /_  / / _ \/ / / / /
 / ___ / /_/ / /_/ /_/ / / / / / / / / /_/  __/ / /_/ /
/_/  |_\__,_/\__/\____/_/ /_/ /_/_/ /___/\___/_/\__, /
                                               /____/

Options:
  -V, --version                      output the version number
  -h, --help                         display help for command

Commands:
  storefront|sf <command> [options]  Collection of tools for storefront
  help [command]                     display help for command

Storefront commands

Usage: am-cli storefront|sf <command>

Collection of tools for storefront.

Options:
  -V, --version  output the version number
  -h, --help     display help for command

Development

How to add a new command

Confirm your command is belongs with some existing module

A new module

  • Create the new module library directory name as {command_name} and put it under the src folder
  • Create a new module entry name as index-{command_name}.js and put it under the bin folder
  • Fill the module content such as the template below
#!/usr/bin/env node
'use strict';

require('../lib/common/colors')();
const Command = require('commander').Command;
const pkg = require('../package.json');
const command = require('../lib/{command_name}');

const program = new Command('am-cli {command_name}')
	.alias('{command_alias}')
	.description('{description}');

program.version(pkg.version).usage('<command> [options]');

program
	.command('test')
	.alias('t')
	.description('Test command')
	.option('--name -n <name>', 'Test command name')
	.action(command.test);

program.parse(process.argv);
  • Add the command above program.parse(process.argv) in the bin/index.js command
program
	.command('{command_name} <command> [options]', '{description}')
	.alias('{command_alias}');
  • Add the new command of bin into the package.json, (optional)
{
	"am-{command_alias}-cli": "bin/index-{command_name}.js",
	"automizely-{command_name}": "bin/index-{command_name}.js"
}

Belongs with some existing module

  • Add the new command into the belongs module same as above add a new module

For more API details, please see the Commander API doc

No license, copyright@Automizely 2021-present