Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
Rename to @absolunet/cli
Browse files Browse the repository at this point in the history
  • Loading branch information
jblandry committed Mar 25, 2017
1 parent 1b083a9 commit 48cf621
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 30 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ test
.gitignore
.sublimelinterrc
.travis.yml
cli-helper.sublime-project
cli.sublime-project
File renamed without changes.
36 changes: 19 additions & 17 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
//--------------------------------------------------------
//-- CLI helper
//-- CLI utilities
//--------------------------------------------------------
'use strict';

const echo = console.log; // eslint-disable-line no-console

const os = require('os');
const path = require('path');
const readPkgUp = require('read-pkg-up');
const chalk = require('chalk');
const pad = require('pad');
const os = require('os');
const path = require('path');
const readPkgUp = require('read-pkg-up');
const chalk = require('chalk');
const pad = require('pad');
// const widestLine = require('widest-line');
// const stringWidth = require('string-width');

delete require.cache[__filename];
const pkgPath = path.dirname(module.parent.filename);
Expand All @@ -21,7 +23,7 @@ const { pkg } = readPkgUp.sync({ cwd:pkgPath });


//-- Static properties
const STATIC = global.___AbsolunetCLIHelper___ ? global.___AbsolunetCLIHelper___ : global.___AbsolunetCLIHelper___ = {
const STATIC = global.___AbsolunetCli___ ? global.___AbsolunetCli___ : global.___AbsolunetCli___ = {
commands: {},
taskWidth: {},
fullUsage: {},
Expand All @@ -43,7 +45,7 @@ const printCmd = (cmd, width = STATIC.baseWidth, spacer = 1) => {



module.exports = class CLIHelper {
module.exports = class Cli {

//-- Usager helpers
static get PLACEHOLDER() {
Expand All @@ -59,7 +61,7 @@ module.exports = class CLIHelper {
}

static optionalPlaceholder(name) {
return `${chalk.reset('[')}${CLIHelper.placeholder(name)}${chalk.reset(']')}`;
return `${chalk.reset('[')}${this.placeholder(name)}${chalk.reset(']')}`;
}


Expand Down Expand Up @@ -113,8 +115,8 @@ module.exports = class CLIHelper {


//-- Show task usage and die
static showTaskUsage(cli) {
echo(`\n${CLIHelper.getTaskUsage(cli.input[0])}`);
static showTaskUsage(meowCli) {
echo(`\n${this.getTaskUsage(meowCli.input[0])}`);
process.exit(2); // eslint-disable-line no-process-exit
}

Expand All @@ -132,16 +134,16 @@ module.exports = class CLIHelper {
}

//-- Refuse flags
static refuseFlags(cli) {
if (Object.keys(cli.flags).length) {
CLIHelper.showTaskUsage(cli);
static refuseFlags(meowCli) {
if (Object.keys(meowCli.flags).length) {
this.showTaskUsage(meowCli);
}
}

//-- Refuse flags & arguments
static refuseFlagsAndArguments(cli) {
if (cli.input.length > 1 || Object.keys(cli.flags).length) {
CLIHelper.showTaskUsage(cli);
static refuseFlagsAndArguments(meowCli) {
if (meowCli.input.length > 1 || Object.keys(meowCli.flags).length) {
this.showTaskUsage(meowCli);
}
}

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "@absolunet/cli-helper",
"name": "@absolunet/cli",
"version": "0.0.1",
"description": "CLI helper",
"description": "CLI utilities",
"definition": "",
"homepage": "https://github.com/absolunet/cli-helper",
"homepage": "https://github.com/absolunet/node-cli",
"author": { "name": "Absolunet", "url": "http://absolunet.com/" },

"license": "MIT",
"repository": { "url": "git://github.com/absolunet/cli-helper.git", "type":"git" },
"bugs": { "url": "https://github.com/absolunet/cli-helper/issues" },
"repository": { "url": "git://github.com/absolunet/node-cli.git", "type":"git" },
"bugs": { "url": "https://github.com/absolunet/node-cli/issues" },

"engines": { "node": ">= 7.7.3" },
"scripts": {
Expand Down
14 changes: 7 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# @absolunet/cli-helper
# @absolunet/cli

[![NPM version](https://img.shields.io/npm/v/@absolunet/cli-helper.svg)](https://www.npmjs.com/package/@absolunet/cli-helper)
[![Travis build](https://api.travis-ci.org/absolunet/cli-helper.svg?branch=master)](https://travis-ci.org/absolunet/cli-helper/builds)
[![Dependencies](https://david-dm.org/absolunet/cli-helper/status.svg)](https://david-dm.org/absolunet/cli-helper)
[![Dev dependencies](https://david-dm.org/absolunet/cli-helper/dev-status.svg)](https://david-dm.org/absolunet/cli-helper?type=dev)
[![NPM version](https://img.shields.io/npm/v/@absolunet/cli.svg)](https://www.npmjs.com/package/@absolunet/cli)
[![Travis build](https://api.travis-ci.org/absolunet/node-cli.svg?branch=master)](https://travis-ci.org/absolunet/node-cli/builds)
[![Dependencies](https://david-dm.org/absolunet/node-cli/status.svg)](https://david-dm.org/absolunet/node-cli)
[![Dev dependencies](https://david-dm.org/absolunet/node-cli/dev-status.svg)](https://david-dm.org/absolunet/node-cli?type=dev)

> CLI helper
> CLI utilities
## License
See the [license](https://github.com/absolunet/cli-helper/blob/master/license).
See the [license](https://github.com/absolunet/node-cli/blob/master/license).

0 comments on commit 48cf621

Please sign in to comment.