New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ionic/cli-utils

Package Overview
Dependencies
Maintainers
12
Versions
525
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ionic/cli-utils - npm Package Compare versions

Comparing version 0.0.1-alpha.ddfcd38a to 0.0.1

1

dist/definitions.d.ts

@@ -94,2 +94,3 @@ /// <reference types="inquirer" />

options?: CommandOption[];
fullName?: string;
}

@@ -96,0 +97,0 @@ export interface ISession {

"use strict";
var __assign = (this && this.__assign) || Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -38,5 +46,5 @@ return new (P || (P = Promise))(function (resolve, reject) {

}
const commandName = (commandEnvironment.pluginName) ? `${commandEnvironment.pluginName}:command` : command.metadata.name;
const fullName = (commandEnvironment.pluginName) ? `${commandEnvironment.pluginName}:command` : command.metadata.name;
if (argv['help'] || argv['h']) {
return console.log(help_1.formatCommandHelp(command.metadata, commandName));
return console.log(help_1.formatCommandHelp(__assign({}, command.metadata, { fullName })));
}

@@ -43,0 +51,0 @@ command.env = commandEnvironment;

@@ -8,1 +8,2 @@ export declare const ICON_SUCCESS = "✔";

export declare function indent(n?: number): string;
export declare function generateFillSpaceStringList(list: string[], optimalLength: number, fillCharacter?: string): string[];

@@ -23,4 +23,11 @@ "use strict";

function indent(n = 4) {
return new Array(n).fill(' ').reduce((a, b) => a + b);
return new Array(n).fill(' ').join('');
}
exports.indent = indent;
function generateFillSpaceStringList(list, optimalLength, fillCharacter = ' ') {
const longestItem = Math.max(...list.map((item) => item.replace(exports.STRIP_ANSI_REGEX, '').length));
const fullLength = longestItem > optimalLength ? longestItem + 1 : optimalLength;
const fullLengthString = Array(fullLength).fill(fillCharacter).join('');
return list.map(item => fullLengthString.substr(0, fullLength - item.length));
}
exports.generateFillSpaceStringList = generateFillSpaceStringList;

3

dist/lib/utils/help.d.ts

@@ -5,2 +5,3 @@ import { CommandData } from '../../definitions';

*/
export declare function formatCommandHelp(cmdMetadata: CommandData, commandName: string): string;
export declare function formatCommandHelp(cmdMetadata: CommandData): string;
export declare function getListOfCommandDetails(cmdMetadataList: CommandData[]): string[];

@@ -8,14 +8,20 @@ "use strict";

*/
function formatCommandHelp(cmdMetadata, commandName) {
function formatCommandHelp(cmdMetadata) {
let description = cmdMetadata.description.split('\n').join('\n ');
let fullName = cmdMetadata.fullName || cmdMetadata.name;
return `
${chalk.bold(description)}
` +
formatUsage(cmdMetadata.inputs, commandName) +
formatInputs(cmdMetadata.inputs) +
formatOptions(cmdMetadata.options) +
formatExamples(cmdMetadata, commandName);
formatCommandUsage(cmdMetadata.inputs, fullName) +
formatCommandInputs(cmdMetadata.inputs) +
formatCommandOptions(cmdMetadata.options) +
formatCommandExamples(cmdMetadata.exampleCommands, fullName);
}
exports.formatCommandHelp = formatCommandHelp;
function formatUsage(inputs = [], commandName) {
function getListOfCommandDetails(cmdMetadataList) {
const fillStringArray = format_1.generateFillSpaceStringList(cmdMetadataList.map(cmdMd => cmdMd.fullName || cmdMd.name), 25, '.');
return cmdMetadataList.map((cmdMd, index) => `${chalk.green(cmdMd.fullName || '')} ${fillStringArray[index]} ${cmdMd.description}`);
}
exports.getListOfCommandDetails = getListOfCommandDetails;
function formatCommandUsage(inputs = [], commandName) {
const headerLine = chalk.bold(`Usage`);

@@ -35,3 +41,3 @@ const usageLine = `$ ionic ${commandName} ${(inputs || [])

}
function formatInputs(inputs = []) {
function formatCommandInputs(inputs = []) {
if (inputs.length === 0) {

@@ -41,7 +47,6 @@ return '';

const headerLine = chalk.bold(`Inputs`);
function inputLineFn({ name, description }) {
const fillStrings = format_1.generateFillSpaceStringList(inputs.map(input => input.name), 25, '.');
function inputLineFn({ name, description }, index) {
const optionList = chalk.green(`${name}`);
const optionListLength = optionList.replace(format_1.STRIP_ANSI_REGEX, '').length;
const fullLength = optionListLength > 25 ? optionListLength + 1 : 25;
return `${optionList} ${Array(fullLength - optionListLength).fill('.').join('')} ${description}`;
return `${optionList} ${fillStrings[index]} ${description}`;
}

@@ -55,3 +60,3 @@ ;

}
function formatOptions(options = []) {
function formatCommandOptions(options = []) {
if (options.length === 0) {

@@ -78,3 +83,3 @@ return '';

}
function formatExamples({ exampleCommands }, commandName) {
function formatCommandExamples(exampleCommands, commandName) {
if (!Array.isArray(exampleCommands)) {

@@ -81,0 +86,0 @@ return '';

{
"name": "@ionic/cli-utils",
"version": "0.0.1-alpha.ddfcd38a",
"version": "0.0.1",
"description": "Ionic CLI Utils",

@@ -5,0 +5,0 @@ "homepage": "https://ionic.io/",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc