110 lines
26 KiB
HTML
110 lines
26 KiB
HTML
<!DOCTYPE html>
|
|
<html class="paged">
|
|
<head>
|
|
<title>Making Your Own</title>
|
|
<link rel="stylesheet" type="text/css" href="/v5/static/style.css">
|
|
</head>
|
|
<body>
|
|
<div class="sidebar">
|
|
<div class="header">
|
|
<div class="logo"><a href="/v5/"><div class="image"></div><div class="name">ethers</div><div class="version">v5.0</div></a></div>
|
|
</div>
|
|
<div class="toc"><div>
|
|
<div class="link title"><a href="/v5/">Documentation</a></div><div class="base show link depth-1"><a href="/v5/getting-started/">Getting Started</a></div><div class="base show link depth-1"><a href="/v5/concepts/">Ethereum Basics</a></div><div class="hide link depth-2"><a href="/v5/concepts/events/">Events</a></div><div class="hide link depth-2"><a href="/v5/concepts/gas/">Gas</a></div><div class="hide link depth-2"><a href="/v5/concepts/security/">Security</a></div><div class="base show link depth-1"><a href="/v5/api/">Application Programming Interface</a></div><div class="hide link depth-2"><a href="/v5/api/contract/">Contract Interaction</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract/">Contract</a></div><div class="hide link depth-3"><a href="/v5/api/contract/contract-factory/">ContractFactory</a></div><div class="hide link depth-3"><a href="/v5/api/contract/example/">Example: ERC-20 Contract</a></div><div class="hide link depth-2"><a href="/v5/api/signer/">Signers</a></div><div class="hide link depth-2"><a href="/v5/api/providers/">Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/provider/">Provider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/jsonrpc-provider/">JsonRpcProvider</a></div><div class="hide link depth-3"><a href="/v5/api/providers/api-providers/">API Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/other/">Other Providers</a></div><div class="hide link depth-3"><a href="/v5/api/providers/types/">Types</a></div><div class="hide link depth-2"><a href="/v5/api/utils/">Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/abi/">Application Binary Interface</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/coder/">AbiCoder</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/formats/">ABI Formats</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/fragments/">Fragments</a></div><div class="hide link depth-4"><a href="/v5/api/utils/abi/interface/">Interface</a></div><div class="hide link depth-3"><a href="/v5/api/utils/address/">Addresses</a></div><div class="hide link depth-3"><a href="/v5/api/utils/bignumber/">BigNumber</a></div><div class="hide link depth-3"><a href="/v5/api/utils/bytes/">Byte Manipulation</a></div><div class="hide link depth-3"><a href="/v5/api/utils/constants/">Constants</a></div><div class="hide link depth-3"><a href="/v5/api/utils/display-logic/">Display Logic and Input</a></div><div class="hide link depth-3"><a href="/v5/api/utils/encoding/">Encoding Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/fixednumber/">FixedNumber</a></div><div class="hide link depth-3"><a href="/v5/api/utils/hashing/">Hashing Algorithms</a></div><div class="hide link depth-3"><a href="/v5/api/utils/hdnode/">HD Wallet</a></div><div class="hide link depth-3"><a href="/v5/api/utils/logger/">Logging</a></div><div class="hide link depth-3"><a href="/v5/api/utils/properties/">Property Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/signing-key/">Signing Key</a></div><div class="hide link depth-3"><a href="/v5/api/utils/strings/">Strings</a></div><div class="hide link depth-3"><a href="/v5/api/utils/transactions/">Transactions</a></div><div class="hide link depth-3"><a href="/v5/api/utils/web/">Web Utilities</a></div><div class="hide link depth-3"><a href="/v5/api/utils/wordlists/">Wordlists</a></div><div class="hide link depth-2"><a href="/v5/api/other/">Other Libraries</a></div><div class="hide link depth-3"><a href="/v5/api/other/assembly/">Assembly</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/dialect/">Ethers ASM Dialect</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/api/">Utilities</a></div><div class="hide link depth-4"><a href="/v5/api/other/assembly/ast/">Abstract Syntax Tree</a></div><div class="hide link depth-3"><a href="/v5/api/other/hardware/">Hardware Wallets</a></div><div class="hide link depth-2"><a href="/v5/api/experimental/">Experimental</a></div><div class="base ancestor show link depth-1"><a href="/v5/cli/">Command Line Interfaces</a></div><div class="show link depth-2"><a href="/v5/cli/ethers/">Sandbox Utility</a></div><div class="show link depth-2"><a href="/v5/cli/asm/">Assembler</a></div><div class="show link depth-2"><a href="/v5/cli/ens/">Ethereum Naming Service</a></div><div class="show link depth-2"><a href="/v5/cli/typescript/">TypeScript</a></div><div class="myself ancestor ancestor show link depth-2"><a href="/v5/cli/plugin/">Making Your Own</a></div><div class="base show link depth-1"><a href="/v5/cookbook/">Cookbook</a></div><div class="base show link depth-1"><a href="/v5/migration/">Migration Guide</a></div><div class="hide link depth-2"><a href="/v5/migration/web3/">Migration: From Web3.js</a></div><div class="hide link depth-2"><a href="/v5/migration/ethers-v4/">Migration: From Ethers v4</a></div><div class="base show link depth-1"><a href="/v5/testing/">Testing</a></div><div class="base show link depth-1"><a href="/v5/contributing/">Contributing and Hacking</a></div><div class="base show link depth-1"><a href="/v5/documentation/">Flatworm Docs</a></div><div class="base show link depth-1"><a href="/v5/license/">License and Copyright</a></div>
|
|
</div></div>
|
|
</div>
|
|
<div class="content">
|
|
<div class="breadcrumbs"><a href="/v5/">Documentation</a> » <a href="/v5/cli/">Command Line Interfaces</a> » <span class="current">Making Your Own</span></div>
|
|
|
|
<a name="cli-diy"></a><a name="cli-diy"></a><h1 class="show-anchors"><div>Making Your Own<div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-diy"></a></div></div></h1><p>The <i>cli</i> library is meant to make it easy to create command line utilities of your own.</p>
|
|
|
|
<a name="cli-cli"></a><a name="cli-diy--cli-cli"></a><h2 class="show-anchors"><div>CLI<div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-cli"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L715">source</a></div></div></h2><p>A <b>CLI</b> handles parsing all the command-line flags, options and arguments and instantiates a <a href="/v5/cli/plugin/#cli-plugin">Plugin</a> to process the command.</p>
|
|
|
|
<p>A <b>CLI</b> may support multiple <a href="/v5/cli/plugin/#cli-plugin">Plugin</a>'s in which case the first argument is used to determine which to run (or if no arguments, the default plugin will be selected) or may be designed to be standalone, in which case exactly one <a href="/v5/cli/plugin/#cli-plugin">Plugin</a> will be used and no command argument is allowed.</p>
|
|
|
|
<a name="cli-addplugin"></a><div class="property show-anchors"><div class="signature"><span class="method">addPlugin</span><span class="symbol">(</span> <span class="param">command</span> <span class="symbol">,</span> <span class="param">pluginClass</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">void</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-addplugin"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L755">source</a></div></div><div class="body"><p>Add a <i>plugin</i> class for the <i>command</i>. After all options and flags have been consumed, the first argument will be consumed and the associated plugin class will be instantiated and run.</p>
|
|
|
|
</div></div><a name="cli-setplugin"></a><div class="property show-anchors"><div class="signature"><span class="method">setPlugin</span><span class="symbol">(</span> <span class="param">pluginClass</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">void</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-setplugin"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L769">source</a></div></div><div class="body"><p>Set a dedicated <a href="/v5/cli/plugin/#cli-plugin">Plugin</a> class which will handle all input. This may not be used in conjuction with addPlugin and will not automatically accept a command from the arguments.</p>
|
|
|
|
</div></div><a name="cli-showusage"></a><div class="property show-anchors"><div class="signature"><span class="method">showUsage</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">message</span> = "" <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">status</span> = <span class="param">0</span> <span class="symbol">]</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">never</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-showusage"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L783">source</a></div></div><div class="body"><p>Shows the usage help screen for the CLI and terminates.</p>
|
|
|
|
</div></div><a name="cli-run"></a><div class="property show-anchors"><div class="signature"><span class="method">run</span><span class="symbol">(</span> <span class="param">args</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< void ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-run"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L910">source</a></div></div><div class="body"><p>Usually the value of <i>args</i> passed in will be <code class="inline">process.argv.slice(2)</code>.</p>
|
|
|
|
</div></div><a name="cli-plugin"></a><a name="cli-diy--cli-plugin"></a><h2 class="show-anchors"><div>Plugin<div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-plugin"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L490">source</a></div></div></h2><p>Each <b>Plugin</b> manages each command of a CLI and is executed in phases.</p>
|
|
|
|
<p>If the usage (i.e. help) of a CLI is requested, the static methods <code class="inline">getHelp</code> and <code class="inline">getOptionHelp</code> are used to geneate the help screen.</p>
|
|
|
|
<p>Otherwise, a plugin is instantiated and the <code class="inline">prepareOptions</code> is called. Each plugin <b>must</b> call <code class="inline">super.prepareOptions</code>, otherwise the basic options are not yet processed. During this time a Plugin should consume all the flags and options it understands, since any left over flags or options will cause the CLI to bail and issue an <i>unknown option</i> error. This should throw if a value for a given option is invalid or some combination of options and flags is not allowed.</p>
|
|
|
|
<p>Once the prepareOptions is complete (the returned promise is resolved), the <code class="inline">prepareArguments</code> is called. This should validate the number of arguments is expected and throw and error if there are too many or too few arguments or if any arguments do not make sense.</p>
|
|
|
|
<p>Once the prepareArguments is complete (the returned promise is resolved), the <code class="inline">run</code> is called.</p>
|
|
|
|
<div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">network</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/providers/types/#providers-Network">Network</a></span><div class="anchors"></div></div><div class="body"><p>The network this plugin is running for.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">provider</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/providers/provider/">Provider</a></span><div class="anchors"></div></div><div class="body"><p>The provider for this plugin is running for.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">accounts</span> <span class="arrow">⇒</span> <span class="returns">Array< <a href="/v5/api/signer/#Signer">Signer</a> ></span><div class="anchors"></div></div><div class="body"><p>The accounts passed into the plugin using <code class="inline">--account</code>, <code class="inline">--account-rpc</code> and <code class="inline">--account-void</code> which this plugin can use.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">gasLimit</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"></div></div><div class="body"><p>The gas limit this plugin should use. This is null if unspecified.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">gasPrice</span> <span class="arrow">⇒</span> <span class="returns"><a href="/v5/api/utils/bignumber/">BigNumber</a></span><div class="anchors"></div></div><div class="body"><p>The gas price this plugin should use. This is null if unspecified.</p>
|
|
|
|
</div></div><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">nonce</span> <span class="arrow">⇒</span> <span class="returns">number</span><div class="anchors"></div></div><div class="body"><p>The initial nonce for the account this plugin should use.</p>
|
|
|
|
</div></div><a name="cli-diy--cli-plugin--methods"></a><h3 class="show-anchors"><div>Methods<div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-diy--cli-plugin--methods"></a></div></div></h3>
|
|
<a name="plugin-prepareoptions"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">prepareOptions</span><span class="symbol">(</span> <span class="param">argParser</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">verifyOnly</span> = <span class="param">false</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< void ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-prepareoptions"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L515">source</a></div></div><div class="body">
|
|
</div></div><a name="plugin-prepareargs"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">prepareArgs</span><span class="symbol">(</span> <span class="param">args</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< void ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-prepareargs"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L655">source</a></div></div><div class="body">
|
|
</div></div><a name="plugin-run"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">run</span><span class="symbol">(</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< void ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-run"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L659">source</a></div></div><div class="body">
|
|
</div></div><a name="plugin-getaddress"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">getAddress</span><span class="symbol">(</span> <span class="param">addressOrName</span> <span class="symbol">[</span> <span class="symbol">,</span> <span class="param">message</span> = "" <span class="symbol">,</span> <span class="symbol">[</span> <span class="param">allowZero</span> = <span class="param">false</span> <span class="symbol">]</span> <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Promise< string ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-getaddress"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L663">source</a></div></div><div class="body"><p>A plugin should use this method to resolve an address. If the resovled address is the zero address and <i>allowZero</i> is not true, an error is raised.</p>
|
|
|
|
</div></div><a name="plugin-dump"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">dump</span><span class="symbol">(</span> <span class="param">header</span> <span class="symbol">,</span> <span class="param">info</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">void</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-dump"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L682">source</a></div></div><div class="body"><p>Dumps the contents of <i>info</i> to the console with a <i>header</i> in a nicely formatted style. In the future, plugins may support a JSON output format which will automatically work with this method.</p>
|
|
|
|
</div></div><a name="plugin-throwusageerror"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">throwUsageError</span><span class="symbol">(</span> <span class="symbol">[</span> <span class="param">message</span> = "" <span class="symbol">]</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">never</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-throwusageerror"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L688">source</a></div></div><div class="body"><p>Stops exectuion of the plugin and shows the help screen of the plugin with the optional <i>message</i>.</p>
|
|
|
|
</div></div><a name="plugin-throwerror"></a><div class="property show-anchors"><div class="signature"><span class="path">plugin</span><span class="symbol">.</span><span class="method">throwError</span><span class="symbol">(</span> <span class="param">message</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">never</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-throwerror"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L693">source</a></div></div><div class="body"><p>Stops execution of the plugin and shows <i>message</i>.</p>
|
|
|
|
</div></div><a name="cli-diy--cli-plugin--static-methods"></a><h3 class="show-anchors"><div>Static Methods<div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-diy--cli-plugin--static-methods"></a></div></div></h3>
|
|
<a name="plugin-gethelp"></a><div class="property show-anchors"><div class="signature"><span class="path">Plugin</span><span class="symbol">.</span><span class="method">getHelp</span> <span class="arrow">⇒</span> <span class="returns">Help</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-gethelp"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L507">source</a></div></div><div class="body"><p>Each subclass should implement this static method which is used to generate the help screen.</p>
|
|
|
|
</div></div><a name="plugin-getoptionshelp"></a><div class="property show-anchors"><div class="signature"><span class="path">Plugin</span><span class="symbol">.</span><span class="method">getOptionHelp</span> <span class="arrow">⇒</span> <span class="returns">Array< Help ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#plugin-getoptionshelp"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L511">source</a></div></div><div class="body"><p>Each subclass should implement this static method if it supports additional options which is used to generate the help screen.</p>
|
|
|
|
</div></div><a name="cli-argparser"></a><a name="cli-diy--cli-argparser"></a><h2 class="show-anchors"><div>ArgParser<div class="anchors"><a class="self" href="/v5/cli/plugin/#cli-argparser"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L292">source</a></div></div></h2><p>The <b>ArgParser</b> is used to parse a command line into flags, options and arguments.</p>
|
|
|
|
<div class="code">/home/ethers> ethers --account wallet.json --yes send ricmoo.eth 1.0
|
|
# An Option ----------^ ^ ^
|
|
# - name = "account" | |
|
|
# - value = "wallet.json" | |
|
|
# A Flag -----------------------------------+ |
|
|
# - name = "yes" |
|
|
# - value = true |
|
|
# Arguments ------------------------------------+
|
|
# - count = 3
|
|
# - [ "send", "ricmoo.eth", "1.0" ]</div><p>Flags are simple binary options (such as the <code class="inline">--yes</code>), which are true if present otherwise false.</p>
|
|
|
|
<p>Options require a single parameter follow them on the command line (such as <code class="inline">--account wallet.json</code>, which nhas the name <code class="inline">account</code> and the value <code class="inline">wallet.json</code>)</p>
|
|
|
|
<p>Arguments are all other values on the command line, and are not accessed through the <b>ArgParser</b> directly.</p>
|
|
|
|
<p>When a CLI is run, an <b>ArgParser</b> is used to validate the command line by using prepareOptions, which consumes all flags and options leaving only the arguments behind, which are then passed into prepareArgs.</p>
|
|
|
|
<a name="argparser-consumeflag"></a><div class="property show-anchors"><div class="signature"><span class="path">argParser</span><span class="symbol">.</span><span class="method">consumeFlag</span><span class="symbol">(</span> <span class="param">name</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">boolean</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#argparser-consumeflag"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L333">source</a></div></div><div class="body"><p>Remove the flag <i>name</i> and return true if it is present.</p>
|
|
|
|
</div></div><a name="argparser-consumemultioptions"></a><div class="property show-anchors"><div class="signature"><span class="path">argParser</span><span class="symbol">.</span><span class="method">consumeMultiOptions</span><span class="symbol">(</span> <span class="param">names</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Array< {name:string,value:string} ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#argparser-consumemultioptions"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L351">source</a></div></div><div class="body"><p>Remove all options which match any name in the Array of <i>names</i> with their values returning the list (in order) of values.</p>
|
|
|
|
</div></div><a name="argparser-consumeoption"></a><div class="property show-anchors"><div class="signature"><span class="path">argParser</span><span class="symbol">.</span><span class="method">consumeOption</span><span class="symbol">(</span> <span class="param">name</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">string</span><div class="anchors"><a class="self" href="/v5/cli/plugin/#argparser-consumeoption"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L380">source</a></div></div><div class="body"><p>Remove the option with its value for <i>name</i> and return the value. This will throw a UsageError if the option is included multiple times.</p>
|
|
|
|
</div></div><a name="argparser-consumeoptions"></a><div class="property show-anchors"><div class="signature"><span class="path">argParser</span><span class="symbol">.</span><span class="method">consumeOptions</span><span class="symbol">(</span> <span class="param">name</span> <span class="symbol">)</span> <span class="arrow">⇒</span> <span class="returns">Array< string ></span><div class="anchors"><a class="self" href="/v5/cli/plugin/#argparser-consumeoptions"></a><a class="source" href="https://github.com/ethers-io/ethers.js/blob/master/packages/cli/src.ts/cli.ts#L376">source</a></div></div><div class="body"><p>Remove all options with their values for <i>name</i> and return the list (in order) of values.</p>
|
|
|
|
</div></div>
|
|
|
|
<div class="footer">
|
|
<div class="nav previous"><a href="/v5/cli/typescript/"><span class="arrow">←</span>TypeScript</a></div>
|
|
<div class="nav next"><a href="/v5/cookbook/">Cookbook<span class="arrow">→</span></a></div>
|
|
</div>
|
|
<div class="copyright">The content of this site is licensed under the <a href="https://choosealicense.com/licenses/cc-by-4.0/">Creative Commons License</a>. Generated on July 5, 2020, 12:0am.</div>
|
|
</div>
|
|
<script src="/v5/static/script.js" type="text/javascript"></script>
|
|
</body>
|
|
</html>
|