(processes, flags)
| 252 | }; |
| 253 | |
| 254 | const listProcesses = async (processes, flags) => { |
| 255 | const memoryThreshold = flags.verbose ? 0 : 1; |
| 256 | const cpuThreshold = flags.verbose ? 0 : 3; |
| 257 | const searcher = new FuzzySearch(processes, ['name'], {caseSensitive: false}); |
| 258 | |
| 259 | const selectedPid = await search({ |
| 260 | message: 'Running processes:', |
| 261 | pageSize: 10, |
| 262 | async source(term = '') { |
| 263 | const matchingProcesses = filterAndSortProcesses(processes, term, searcher, flags); |
| 264 | return matchingProcesses.map(process_ => renderProcessForDisplay(process_, flags, memoryThreshold, cpuThreshold)); |
| 265 | }, |
| 266 | }); |
| 267 | |
| 268 | performKillSequence(selectedPid); |
| 269 | }; |
| 270 | |
| 271 | const init = async flags => { |
| 272 | escExit(); |
no test coverage detected