Skip to content

Commit f58a41b

Browse files
committed
improvements
1 parent 092d538 commit f58a41b

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

src/commands/threat-feed.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Not a fan of adding this, mainly doing it because
1+
/* Not a fan of adding the no-check, mainly doing it because
22
the types associated with the blessed packages
33
create some type errors
44
*/
@@ -153,18 +153,22 @@ async function fetchThreatFeed(
153153

154154
const screen = blessed.screen()
155155

156-
var table = contrib.table(
157-
{ keys: 'true'
158-
, fg: 'white'
159-
, selectedFg: 'white'
160-
, selectedBg: 'magenta'
161-
, interactive: 'true'
162-
, label: 'Threat feed'
163-
, width: '100%'
164-
, height: '100%'
165-
, border: {type: "line", fg: "cyan"}
166-
, columnSpacing: 5 //in chars
167-
, columnWidth: [10, 30, 10, 20, 20] /*in chars*/ })
156+
var table = contrib.table({
157+
keys: 'true',
158+
fg: 'white',
159+
selectedFg: 'white',
160+
selectedBg: 'magenta',
161+
interactive: 'true',
162+
label: 'Threat feed',
163+
width: '100%',
164+
height: '100%',
165+
border: {
166+
type: "line",
167+
fg: "cyan"
168+
},
169+
columnSpacing: 5, //in chars
170+
columnWidth: [10, 30, 8, 20, 16, 50] /*in chars*/
171+
})
168172

169173
// allow control the table with the keyboard
170174
table.focus()
@@ -173,8 +177,7 @@ async function fetchThreatFeed(
173177

174178
const formattedOutput = formatResults(data.results)
175179

176-
table.setData(
177-
{ headers: ['Ecosystem', 'Name', 'Version', 'Threat type', 'Detected at'], data: formattedOutput})
180+
table.setData({ headers: ['Ecosystem', 'Name', 'Version', 'Threat type', 'Detected at', 'Details'], data: formattedOutput })
178181

179182
screen.render()
180183

@@ -193,7 +196,7 @@ const formatResults = (data: ThreatResult[]) => {
193196
const diff = getHourDiff(timeStart, timeEnd)
194197
const hourDiff = diff > 0 ? `${diff} hours ago` : `${getMinDiff(timeStart, timeEnd)} minutes ago`
195198

196-
return [ecosystem, decodeURIComponent(name), version, d.threatType, hourDiff]
199+
return [ecosystem, decodeURIComponent(name), version, d.threatType, hourDiff, d.locationHtmlUrl]
197200
})
198201
}
199202

0 commit comments

Comments
 (0)