mirror of
https://github.com/appium/appium.git
synced 2026-02-05 00:58:56 -06:00
Bumps [argparse](https://github.com/nodeca/argparse) from 1.0.10 to 2.0.1. - [Release notes](https://github.com/nodeca/argparse/releases) - [Changelog](https://github.com/nodeca/argparse/blob/master/CHANGELOG.md) - [Commits](https://github.com/nodeca/argparse/compare/1.0.10...2.0.1) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Mykola Mokhnach <mokhnach@gmail.com>
78 lines
1.8 KiB
JavaScript
78 lines
1.8 KiB
JavaScript
import { Action } from 'argparse';
|
|
|
|
|
|
const DEFAULT_CAPS_ARG = '--default-capabilities';
|
|
|
|
|
|
class StoreDeprecatedAction extends Action {
|
|
constructor (options = {}) {
|
|
const opts = Object.assign({}, options);
|
|
let helpPrefix = '[DEPRECATED]';
|
|
if (opts.deprecated_for) {
|
|
helpPrefix = `[DEPRECATED, use ${opts.deprecated_for} instead]`;
|
|
delete opts.deprecated_for;
|
|
}
|
|
if (opts.help) {
|
|
opts.help = `${helpPrefix} - ${opts.help}`;
|
|
} else {
|
|
opts.help = helpPrefix;
|
|
}
|
|
super(opts);
|
|
}
|
|
|
|
call (parser, namespace, values) {
|
|
namespace[this.dest] = values;
|
|
}
|
|
}
|
|
|
|
|
|
class StoreDeprecatedTrueAction extends StoreDeprecatedAction {
|
|
constructor (options = {}) {
|
|
super(Object.assign({}, options, {const: true, nargs: 0}));
|
|
}
|
|
|
|
call (parser, namespace) {
|
|
namespace[this.dest] = this.const;
|
|
}
|
|
}
|
|
|
|
|
|
class StoreDeprecatedDefaultCapabilityAction extends StoreDeprecatedAction {
|
|
constructor (options = {}) {
|
|
super(Object.assign({}, options, {deprecated_for: DEFAULT_CAPS_ARG}));
|
|
}
|
|
|
|
_writeDefaultCap (namespace, value) {
|
|
namespace[this.dest] = value;
|
|
if (value === this.default) {
|
|
return;
|
|
}
|
|
|
|
if (!namespace.defaultCapabilities) {
|
|
namespace.defaultCapabilities = {};
|
|
}
|
|
namespace.defaultCapabilities[this.dest] = value;
|
|
}
|
|
|
|
call (parser, namespace, values) {
|
|
this._writeDefaultCap(namespace, values);
|
|
}
|
|
}
|
|
|
|
|
|
class StoreDeprecatedDefaultCapabilityTrueAction extends StoreDeprecatedDefaultCapabilityAction {
|
|
constructor (options = {}) {
|
|
super(Object.assign({}, options, {const: true, nargs: 0}));
|
|
}
|
|
|
|
call (parser, namespace) {
|
|
this._writeDefaultCap(namespace, this.const);
|
|
}
|
|
}
|
|
|
|
export {
|
|
StoreDeprecatedAction, StoreDeprecatedTrueAction,
|
|
StoreDeprecatedDefaultCapabilityAction, StoreDeprecatedDefaultCapabilityTrueAction,
|
|
DEFAULT_CAPS_ARG,
|
|
};
|