Skip to content

Commit

Permalink
feat(entrypoints): add pretty print option
Browse files Browse the repository at this point in the history
the `entrypoints:list` command can pretty print
list of entrypoints if the flag --pretty passed
or equal to `true`
  • Loading branch information
maksadbek committed Aug 22, 2024
1 parent e059024 commit 488612f
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions src/Commands/GetEntryPoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ export class GetEntryPoints implements CommandModule {
describe: 'Limit the number of entrypoints',
default: 10
})
.option('pretty', {
describe: 'Pretty print the output',
boolean: true,
default: false
})
.option('connectivity', {
describe: 'Filter by connectivity',
array: true,
Expand Down Expand Up @@ -70,20 +75,18 @@ export class GetEntryPoints implements CommandModule {
status: args.status as string[]
});

if (args.verbose) {
// eslint-disable-next-line no-console
console.log('%j', entryPoints);
} else {
// eslint-disable-next-line no-console
console.log(
'%j',
entryPoints.map((entryPoint) => ({
const ep = args.verbose
? entryPoints.map((entryPoint) => ({
id: entryPoint.id,
method: entryPoint.method,
url: entryPoint.url
}))
);
}
: entryPoints;

// eslint-disable-next-line no-console
console.log(
args.pretty ? JSON.stringify(ep, null, 4) : JSON.stringify(ep)
);

process.exitCode = 0;
} catch (e) {
Expand Down

0 comments on commit 488612f

Please sign in to comment.