Skip to content

Commit

Permalink
Add sorting to snapshot list output
Browse files Browse the repository at this point in the history
Apparently readdir is sorted on
UNIX but not on Windows;
nodejs/node#3232

Add sorting on name explicitly.

Test plan:
* sider snapshot list still sorts on
  snapshot name.
  • Loading branch information
jonaslu committed Jul 26, 2023
1 parent 96864c3 commit c23ad3c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion commands/snapshot/list.js
Expand Up @@ -14,7 +14,9 @@ async function list() {
const headings = ['name', 'engine', 'created', 'cloned by'].map(heading => chalk.cyanBright(heading));
snapshotListingsTable.addData(...headings);

for (let i = 0; i<allSnapshots.length; i++) {
const allSnapshotsSorted = allSnapshots.sort((a,b) => a.snapshotName.localeCompare(b.snapshotName));

for (let i = 0; i<allSnapshotsSorted.length; i++) {
const { snapshotName, engineName, fstats: { created }} = allSnapshots[i];
const timeSinceCreated = moment(created).from(moment());

Expand Down

0 comments on commit c23ad3c

Please sign in to comment.