Socket
Socket
Sign inDemoInstall

@microsoft/ts-command-line

Package Overview
Dependencies
Maintainers
2
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/ts-command-line - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

EULA/Microsoft Sharepoint Framework - Standalone (free) Use Terms - Basque.docx

28

CHANGELOG.json

@@ -5,2 +5,30 @@ {

{
"version": "2.0.0",
"tag": "@microsoft/ts-command-line_v2.0.0",
"date": "Fri, 17 Feb 2017 23:09:23 GMT",
"comments": {
"patch": [
{
"comment": "Locked version numbers for @types packages"
},
{
"comment": "Updated .npmignore"
}
],
"minor": [
{
"comment": "Added a \"option\" parameter, which can limit the input to a list of possible strings."
},
{
"comment": "Added the ability to give custom names to keys in the help menu."
}
],
"major": [
{
"comment": "General availability"
}
]
}
},
{
"version": "1.1.1",

@@ -7,0 +35,0 @@ "tag": "@microsoft/ts-command-line_v1.1.1",

19

CHANGELOG.md
# Change Log - @microsoft/ts-command-line
This log was last generated on Tue, 06 Dec 2016 20:44:26 GMT and should not be manually modified.
This log was last generated on Wed, 22 Feb 2017 21:16:36 GMT and should not be manually modified.
## 2.0.0
Fri, 17 Feb 2017 23:09:23 GMT
### Breaking changes
- General availability
### Minor changes
- Added a "option" parameter, which can limit the input to a list of possible strings.
- Added the ability to give custom names to keys in the help menu.
### Patches
- Locked version numbers for @types packages
- Updated .npmignore
## 1.1.1

@@ -6,0 +23,0 @@ Tue, 06 Dec 2016 20:44:26 GMT

7

lib/CommandLineAction.js

@@ -10,3 +10,3 @@ /**

};
var CommandLineParameterProvider_1 = require('./CommandLineParameterProvider');
var CommandLineParameterProvider_1 = require("./CommandLineParameterProvider");
/**

@@ -20,4 +20,5 @@ * Represents a sub-command that is part of the CommandLineParser command line.

function CommandLineAction(options) {
_super.call(this);
this.options = options;
var _this = _super.call(this) || this;
_this.options = options;
return _this;
}

@@ -24,0 +25,0 @@ CommandLineAction.prototype.buildParser = function (actionsSubParser) {

@@ -21,2 +21,10 @@ /**

}
export interface IKeyedCommandLineDefinition extends IBaseCommandLineDefinition {
/**
* The key used to identify the value of this parameter. This must be a unique value. If it is
* omitted, a unique key is created. This key name appears in the help menu.
* For certain definitions, the key value is not surfaced in the UI.
*/
key?: string;
}
/**

@@ -30,3 +38,3 @@ * For use with CommandLineParser, this interface represents a boolean flag command line parameter

*/
export interface ICommandLineStringDefinition extends IBaseCommandLineDefinition {
export interface ICommandLineStringDefinition extends IKeyedCommandLineDefinition {
}

@@ -36,8 +44,18 @@ /**

*/
export interface ICommandLineStringListDefinition extends IBaseCommandLineDefinition {
export interface ICommandLineStringListDefinition extends IKeyedCommandLineDefinition {
}
/**
* For use with CommandLineParser, this interface represents a parameter which is constrained to
* a list of possible options
*/
export interface ICommandLineOptionDefinition extends IBaseCommandLineDefinition {
/**
* A list of strings (which contain no spaces), of possible options which can be selected
*/
options: string[];
}
/**
* For use with CommandLineParser, this interface represents an integer command line parameter
*/
export interface ICommandLineIntegerDefinition extends IBaseCommandLineDefinition {
export interface ICommandLineIntegerDefinition extends IKeyedCommandLineDefinition {
}

@@ -20,2 +20,4 @@ /**

}
export declare class CommandLineOptionParameter extends CommandLineParameter<string> {
}
export declare class CommandLineStringParameter extends CommandLineParameter<string> {

@@ -22,0 +24,0 @@ }

@@ -33,6 +33,14 @@ "use strict";

exports.CommandLineParameter = CommandLineParameter;
var CommandLineOptionParameter = (function (_super) {
__extends(CommandLineOptionParameter, _super);
function CommandLineOptionParameter() {
return _super !== null && _super.apply(this, arguments) || this;
}
return CommandLineOptionParameter;
}(CommandLineParameter));
exports.CommandLineOptionParameter = CommandLineOptionParameter;
var CommandLineStringParameter = (function (_super) {
__extends(CommandLineStringParameter, _super);
function CommandLineStringParameter() {
_super.apply(this, arguments);
return _super !== null && _super.apply(this, arguments) || this;
}

@@ -45,3 +53,3 @@ return CommandLineStringParameter;

function CommandLineStringListParameter() {
_super.apply(this, arguments);
return _super !== null && _super.apply(this, arguments) || this;
}

@@ -54,3 +62,3 @@ return CommandLineStringListParameter;

function CommandLineFlagParameter() {
_super.apply(this, arguments);
return _super !== null && _super.apply(this, arguments) || this;
}

@@ -63,3 +71,3 @@ return CommandLineFlagParameter;

function CommandLineIntegerParameter() {
_super.apply(this, arguments);
return _super !== null && _super.apply(this, arguments) || this;
}

@@ -66,0 +74,0 @@ return CommandLineIntegerParameter;

@@ -5,4 +5,4 @@ /**

import * as argparse from 'argparse';
import { ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineIntegerDefinition } from './CommandLineDefinition';
import { ICommandLineParserData, CommandLineFlagParameter, CommandLineStringParameter, CommandLineStringListParameter, CommandLineIntegerParameter } from './CommandLineParameter';
import { ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineIntegerDefinition, ICommandLineOptionDefinition } from './CommandLineDefinition';
import { ICommandLineParserData, CommandLineFlagParameter, CommandLineStringParameter, CommandLineStringListParameter, CommandLineIntegerParameter, CommandLineOptionParameter } from './CommandLineParameter';
/**

@@ -16,2 +16,3 @@ * This is the common base class for CommandLineAction and CommandLineParser

private _parameters;
private _keys;
constructor();

@@ -39,6 +40,7 @@ /**

protected defineIntegerParameter(options: ICommandLineIntegerDefinition): CommandLineIntegerParameter;
protected defineOptionParameter(options: ICommandLineOptionDefinition): CommandLineOptionParameter;
protected processParsedData(data: ICommandLineParserData): void;
private _createKeyName();
private _createParameter(definition, argparseOptions?, converter?);
private _getKey(parameterLongName, key?);
private _createParameter(definition, argparseOptions?, key?, converter?);
}
export default CommandLineParameterProvider;

@@ -5,3 +5,4 @@ /**

"use strict";
var CommandLineParameter_1 = require('./CommandLineParameter');
var colors = require("colors");
var CommandLineParameter_1 = require("./CommandLineParameter");
/**

@@ -14,2 +15,3 @@ * This is the common base class for CommandLineAction and CommandLineParser

this._parameters = [];
this._keys = new Map();
}

@@ -28,3 +30,3 @@ /**

CommandLineParameterProvider.prototype.defineStringParameter = function (options) {
return this._createParameter(options);
return this._createParameter(options, undefined, options.key);
};

@@ -37,3 +39,3 @@ /**

action: 'append'
});
}, options.key);
};

@@ -46,2 +48,7 @@ /**

type: 'int'
}, options.key);
};
CommandLineParameterProvider.prototype.defineOptionParameter = function (options) {
return this._createParameter(options, {
choices: options.options
});

@@ -56,6 +63,13 @@ };

};
CommandLineParameterProvider.prototype._createKeyName = function () {
return 'key_' + (CommandLineParameterProvider._keyCounter++).toString();
CommandLineParameterProvider.prototype._getKey = function (parameterLongName, key) {
if (key === void 0) { key = 'key_' + (CommandLineParameterProvider._keyCounter++).toString(); }
if (this._keys.has(key)) {
var otherParam = this._keys.get(key);
throw colors.red("The parameter \"" + parameterLongName + "\" tried to define a key which was already " +
("defined by the \"" + otherParam + "\" parameter. Ensure that the keys values are unique."));
}
this._keys.set(key, parameterLongName);
return key;
};
CommandLineParameterProvider.prototype._createParameter = function (definition, argparseOptions,
CommandLineParameterProvider.prototype._createParameter = function (definition, argparseOptions, key,
/* tslint:disable-next-line:no-any */

@@ -68,4 +82,5 @@ converter) {

names.push(definition.parameterLongName);
/* tslint:disable-next-line:no-any */
var result = new CommandLineParameter_1.CommandLineParameter(this._createKeyName(), converter);
/* tslint:disable:no-any */
var result = new CommandLineParameter_1.CommandLineParameter(this._getKey(definition.parameterLongName, key), converter);
/* tslint:enable:no-any */
this._parameters.push(result);

@@ -76,4 +91,4 @@ var baseArgparseOptions = {

};
Object.keys(argparseOptions || {}).forEach(function (key) {
baseArgparseOptions[key] = argparseOptions[key];
Object.keys(argparseOptions || {}).forEach(function (keyVal) {
baseArgparseOptions[keyVal] = argparseOptions[keyVal];
});

@@ -83,5 +98,5 @@ this.argumentParser.addArgument(names, baseArgparseOptions);

};
CommandLineParameterProvider._keyCounter = 0;
return CommandLineParameterProvider;
}());
CommandLineParameterProvider._keyCounter = 0;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -88,0 +103,0 @@ exports.default = CommandLineParameterProvider;

@@ -10,5 +10,5 @@ /**

};
var argparse = require('argparse');
var colors = require('colors');
var CommandLineParameterProvider_1 = require('./CommandLineParameterProvider');
var argparse = require("argparse");
var colors = require("colors");
var CommandLineParameterProvider_1 = require("./CommandLineParameterProvider");
/**

@@ -25,17 +25,18 @@ * The "argparse" library is a relatively advanced command-line parser with features such

function CommandLineParser(options) {
_super.call(this);
this._options = options;
this._actions = [];
this.argumentParser = new argparse.ArgumentParser({
var _this = _super.call(this) || this;
_this._options = options;
_this._actions = [];
_this.argumentParser = new argparse.ArgumentParser({
addHelp: true,
prog: this._options.toolFilename,
description: this._options.toolDescription,
prog: _this._options.toolFilename,
description: _this._options.toolDescription,
epilog: colors.bold('For detailed help about a specific command, use:'
+ (" " + this._options.toolFilename + " <command> -h"))
+ (" " + _this._options.toolFilename + " <command> -h"))
});
this._actionsSubParser = this.argumentParser.addSubparsers({
_this._actionsSubParser = _this.argumentParser.addSubparsers({
metavar: '<command>',
dest: 'action'
});
this.onDefineParameters();
_this.onDefineParameters();
return _this;
}

@@ -42,0 +43,0 @@ /**

export { default as CommandLineAction, ICommandLineActionOptions } from './CommandLineAction';
export { IBaseCommandLineDefinition, ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineIntegerDefinition } from './CommandLineDefinition';
export { ICommandLineParserData, CommandLineParameter, CommandLineStringParameter, CommandLineStringListParameter, CommandLineFlagParameter, CommandLineIntegerParameter } from './CommandLineParameter';
export { IBaseCommandLineDefinition, ICommandLineFlagDefinition, ICommandLineStringDefinition, ICommandLineStringListDefinition, ICommandLineIntegerDefinition, ICommandLineOptionDefinition } from './CommandLineDefinition';
export { ICommandLineParserData, CommandLineParameter, CommandLineStringParameter, CommandLineStringListParameter, CommandLineFlagParameter, CommandLineIntegerParameter, CommandLineOptionParameter } from './CommandLineParameter';
export { default as CommandLineParameterProvider } from './CommandLineParameterProvider';
export { ICommandListParserOptions, default as CommandLineParser } from './CommandLineParser';
"use strict";
var CommandLineAction_1 = require('./CommandLineAction');
var CommandLineAction_1 = require("./CommandLineAction");
exports.CommandLineAction = CommandLineAction_1.default;
var CommandLineParameter_1 = require('./CommandLineParameter');
var CommandLineParameter_1 = require("./CommandLineParameter");
exports.CommandLineParameter = CommandLineParameter_1.CommandLineParameter;

@@ -10,7 +10,8 @@ exports.CommandLineStringParameter = CommandLineParameter_1.CommandLineStringParameter;

exports.CommandLineIntegerParameter = CommandLineParameter_1.CommandLineIntegerParameter;
var CommandLineParameterProvider_1 = require('./CommandLineParameterProvider');
exports.CommandLineOptionParameter = CommandLineParameter_1.CommandLineOptionParameter;
var CommandLineParameterProvider_1 = require("./CommandLineParameterProvider");
exports.CommandLineParameterProvider = CommandLineParameterProvider_1.default;
var CommandLineParser_1 = require('./CommandLineParser');
var CommandLineParser_1 = require("./CommandLineParser");
exports.CommandLineParser = CommandLineParser_1.default;
//# sourceMappingURL=index.js.map
{
"name": "@microsoft/ts-command-line",
"version": "1.1.1",
"version": "2.0.0",
"description": "An object-oriented command-line parser for TypeScript",

@@ -12,14 +12,16 @@ "main": "lib/index.js",

},
"license": "SEE LICENSE IN LICENSE.docx",
"license": "SEE LICENSE IN \"EULA\" FOLDER",
"homepage": "http://aka.ms/spfx",
"dependencies": {
"argparse": "~1.0.7",
"colors": "~1.1.2",
"@types/node": ">=6.0.51 <6.9.1"
"@types/node": "6.0.62"
},
"devDependencies": {
"@types/es6-collections": "0.5.29",
"chai": "~3.5.0",
"gulp": "~3.9.1",
"mocha": "~2.5.3",
"@microsoft/sp-build-node": "~0.2.0"
"@microsoft/sp-build-node": "~1.0.0"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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