Fix inaccessible yargs instance error (#5531)

This commit is contained in:
Jeeyong Um
2023-03-09 19:16:11 +02:00
committed by GitHub
parent 91161b95c3
commit aa30b39525
3 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -6,6 +6,7 @@
import process from 'process';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { ApiPromise, WsProvider } from '@polkadot/api';
@@ -29,7 +30,7 @@ type ArgV = { ws: string };
export function main (): void {
// retrieve and parse arguments - we do this globally, since this is a single command
const { ws } = yargs
const { ws } = yargs(hideBin(process.argv))
.usage('Usage: [options]')
.wrap(120)
.strict()
+2 -1
View File
@@ -6,6 +6,7 @@ import type { HexString } from '@polkadot/util/types';
import fs from 'fs';
import path from 'path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import { Definitions, DefinitionsTypes } from '@polkadot/types/types';
import { formatNumber, isHex } from '@polkadot/util';
@@ -71,7 +72,7 @@ async function generate (metaHex: HexString, pkg: string | undefined, output: st
type ArgV = { endpoint: string; output: string; package?: string; strict?: boolean };
async function mainPromise (): Promise<void> {
const { endpoint, output, package: pkg, strict: isStrict } = yargs.strict().options({
const { endpoint, output, package: pkg, strict: isStrict } = yargs(hideBin(process.argv)).strict().options({
endpoint: {
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
required: true,
+2 -1
View File
@@ -6,6 +6,7 @@ import type { HexString } from '@polkadot/util/types';
import fs from 'fs';
import path from 'path';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';
import * as substrateDefs from '@polkadot/types/interfaces/definitions';
import { isHex } from '@polkadot/util';
@@ -18,7 +19,7 @@ import { assertDir, assertFile, getMetadataViaWs } from './util/index.js';
type ArgV = { input: string; package: string; endpoint?: string; };
async function mainPromise (): Promise<void> {
const { endpoint, input, package: pkg } = yargs.strict().options({
const { endpoint, input, package: pkg } = yargs(hideBin(process.argv)).strict().options({
endpoint: {
description: 'The endpoint to connect to (e.g. wss://kusama-rpc.polkadot.io) or relative path to a file containing the JSON output of an RPC state_getMetadata call',
type: 'string'