Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
result = await response.json()
debug(JSON.stringify(result, null, 2))
} catch (err) {
debug(err)
}
if (flags.all || flags.apibuild) {
data.push({ Property: PropertyGet.flags.apibuild.description, Value: result.build })
}
if (flags.all || flags.apibuildno) {
data.push({ Property: PropertyGet.flags.apibuildno.description, Value: result.buildno })
}
}
cli.table(data,
{
Property: { minWidth: 10 },
Value: { minWidth: 20 }
},
{
printLine: this.log,
'no-truncate': true,
...flags // parsed flags
})
}
}
const {cli} = require('cli-ux');
const {calculatePages} = require('../../common');
const data = [];
body.domains.map(domain =>
data.push({
name: domain.name,
ttl: domain.ttl,
zone_file: domain.zone_file
})
);
const {currentPage, totalPages} = calculatePages(body.links);
cli.table(data, columns, options);
if (totalPages > 1) {
this.log('Current Page:', currentPage);
this.log('Total Pages:', totalPages);
}
}
} catch (error) {
spinner.stop();
this.error(error.message);
}
}
}
async run () {
try {
const { flags } = this.parse(NamespaceList)
const ow = await this.wsk()
const result = await ow.namespaces.list()
if (flags.json) {
this.logJSON('', result)
} else {
const columns = {
namespaces: {
minWidth: 20,
get: row => row
}
}
cli.table(result, columns)
}
} catch (err) {
this.handleError('failed to list namespaces', err)
}
}
}
body.actions.map(action =>
data.push({
id: action.id,
status: action.status,
resource_type: action.resource_type,
resource_id: action.resource_id,
type: action.type,
started_at: new Date(action.started_at).toUTCString(),
completed_at: new Date(action.completed_at).toUTCString(),
region: action.region_slug
})
);
const {currentPage, totalPages} = calculatePages(body.links);
cli.table(data, columns, options);
if (totalPages > 1) {
this.log('Current Page:', currentPage);
this.log('Total Pages:', totalPages);
}
}
} catch (error) {
spinner.stop();
this.error(error.message);
}
}
}
async run() {
const res = this.parse(ElectionCurrent)
cli.action.start('Fetching currently elected Validators')
const election = await this.kit.contracts.getElection()
const validators = await this.kit.contracts.getValidators()
const signers = await election.getCurrentValidatorSigners()
const validatorList = await Promise.all(
signers.map((addr) => validators.getValidatorFromSigner(addr))
)
cli.action.stop()
cli.table(validatorList, validatorTable, { 'no-truncate': !res.flags.truncate })
}
}
await cliWrap(this, flags.verbose, async () => {
const db = await IdentityDB.load(identityDBPath(flags.profile))
const sorted = db.list()
if (sorted.length === 0) {
logger.info('No saved identities yet. Try adding one with the "save-identity" command.')
return
}
const longestID = longestFieldLength(sorted, 'id')
const longestKeybaseID = longestFieldLength(sorted, 'keybaseID')
cli.table(sorted, {
id: {
header: 'id',
minWidth: longestID + 5,
},
canSignWithKeybase: {
header: 'can_sign_with_keybase',
minWidth: 'can_sign_with_keybase'.length + 5,
get: row => row.canSignWithKeybase() ? 'yes' : '',
},
canSignWithImages: {
header: 'can_sign_with_images',
minWidth: 'can_sign_with_images'.length + 5,
get: row => row.canSignWithImages() ? 'yes' : '',
},
keybaseID: {
header: 'keybase_id',
body.volumes.map(volume => {
const regionName = volume.region.name;
const createdAt = volume.created_at;
delete volume.region;
delete volume.created_at;
return data.push({
region: regionName,
created_at: new Date(createdAt).toUTCString(),
...volume
});
});
const {currentPage, totalPages} = calculatePages(body.links);
cli.table(data, columns, options);
if (totalPages > 1) {
this.log('Current Page:', currentPage);
this.log('Total Pages:', totalPages);
}
}
} catch (error) {
spinner.stop();
this.error(error);
}
}
}
async run() {
const { args } = this.parse(List)
cli.action.start('Fetching commitments...')
const commitments = await new LockedGoldAdapter(this.web3).getCommitments(args.account)
cli.action.stop()
cli.log(chalk.bold.yellow('Total Gold Locked \t') + commitments.total.gold)
cli.log(chalk.bold.red('Total Account Weight \t') + commitments.total.weight)
if (commitments.locked.length > 0) {
cli.table(commitments.locked, {
noticePeriod: { header: 'NoticePeriod', get: (a) => a.time.toString() },
value: { get: (a) => a.value.toString() },
})
}
if (commitments.notified.length > 0) {
cli.table(commitments.notified, {
availabilityTime: { header: 'AvailabilityTime', get: (a) => a.time.toString() },
value: { get: (a) => a.value.toString() },
})
}
}
}
processResponse(this, res, () => {
const apps = res.data.data.filter((app: any) => app.type === "nodeproxy_apps")
cli.table(apps, {
org: {
header: "Organization",
get: (row: any) => row.attributes.org
},
name: {
header: "Name",
get: (row: any) => row.attributes.name
},
version: {
header: "Version",
get: (row: any) => row.attributes.version
}
})
})
}
public async run() {
const { flags } = this.parse(Releases)
const client = this.gqlClient(flags)
const appName = this.getAppName(flags)
const resp = await client.query({
query: RELEASES,
variables: {
appId: appName
}
})
const { app } = resp.data
cli.table(app.releases.nodes, {
version: {
get: (row: any) => `v${row.version}`
},
description: {
get: (row: any) => row.description
},
user: {
get: (row: any) => row.user.email
},
date: {
get: (row: any) => row.createdAt
}
})
}
}