Skip to content

Commit 481730f

Browse files
committed
update metadata command
1 parent 0484122 commit 481730f

File tree

2 files changed

+5
-27
lines changed

2 files changed

+5
-27
lines changed

lib/commands/fullscans/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { create } from './create.js'
22
import { del } from './delete.js'
33
import { list } from './list.js'
4+
import { metadata } from './metadata.js'
45
import { stream } from './stream.js'
56
import { meowWithSubcommands } from '../../utils/meow-with-subcommands.js'
67

@@ -15,7 +16,8 @@ export const fullscans = {
1516
create,
1617
stream,
1718
list,
18-
del
19+
del,
20+
metadata
1921
},
2022
{
2123
argv,

lib/commands/fullscans/metadata.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
/* eslint-disable no-console */
22

3-
import chalk from 'chalk'
4-
// @ts-ignore
5-
import chalkTable from 'chalk-table'
63
import meow from 'meow'
74
import ora from 'ora'
85

@@ -107,30 +104,9 @@ async function getOrgScanMetadata (orgSlug, scanId, spinner) {
107104
}
108105
spinner.stop()
109106

110-
console.log(`\n Listing scans for: ${orgSlug} \n`)
107+
console.log('\nScan metadata: \n')
111108

112-
const options = {
113-
columns: [
114-
{ field: 'id', name: chalk.magenta('ID') },
115-
{ field: 'report_url', name: chalk.magenta('Scan URL') },
116-
{ field: 'branch', name: chalk.magenta('Branch') },
117-
{ field: 'created_at', name: chalk.magenta('Created at') }
118-
]
119-
}
120-
121-
// @ts-ignore
122-
const formattedResults = result.data.results.map(d => {
123-
return {
124-
id: d.id,
125-
report_url: chalk.underline(`${d.html_report_url}`),
126-
created_at: d.created_at ? new Date(d.created_at).toLocaleDateString('en-us', { year: 'numeric', month: 'short', day: 'numeric' }) : '',
127-
branch: d.branch
128-
}
129-
})
130-
131-
const table = chalkTable(options, formattedResults)
132-
133-
console.log(table, '\n')
109+
console.log(result.data)
134110

135111
return {
136112
data: result.data

0 commit comments

Comments
 (0)