forked from appium/appium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(deps): bump argparse from 1.0.10 to 2.0.1 (appium#14687)
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](nodeca/argparse@1.0.10...2.0.1) Signed-off-by: dependabot-preview[bot] <[email protected]> Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com> Co-authored-by: Mykola Mokhnach <[email protected]>
- Loading branch information
1 parent
a88f51d
commit 163b34d
Showing
10 changed files
with
382 additions
and
377 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.