Skip to content

Commit

Permalink
chore(cli): shorten path to fit console
Browse files Browse the repository at this point in the history
  • Loading branch information
davidenke committed Oct 26, 2024
1 parent 840fed9 commit 83ed784
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/cli.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { existsSync } from 'node:fs';
import { mkdir, rm, watch, writeFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import { exit } from 'node:process';
import { exit, stdout } from 'node:process';
import { parseArgs } from 'node:util';

import { loadDecapConfig } from './utils/decap.utils.js';
Expand Down Expand Up @@ -70,8 +70,13 @@ export async function loadAndTransformCollections(from?: string, to?: string, is

// inform user
const action = isUpdate ? 'updated at' : 'written to';
const shortPath = path.substring(path.length - 35);
console.info(`> ${collection.name} schema ${action} ...${shortPath}`);
const before = `> ${collection.name} schema ${action} `;
const { columns = 120 } = stdout;
const dots = '...';
const chars = before.length + dots.length;
const shortPath = `${dots}${path.substring(path.length - columns + chars)}`;
const message = `${before}${path.length < columns - chars ? path : shortPath}`;
console.info(message);
}),
);
}
Expand Down

0 comments on commit 83ed784

Please sign in to comment.