mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 18:56:25 +00:00
fleet: Use the oclif output formatter
Change-type: major Signed-off-by: Matthew Yarmolinsky <matthew-timothy@balena.io>
This commit is contained in:
parent
c735f13636
commit
6ee8d8a899
@ -22,7 +22,7 @@ import type { Release } from 'balena-sdk';
|
|||||||
import Command from '../../command';
|
import Command from '../../command';
|
||||||
import * as cf from '../../utils/common-flags';
|
import * as cf from '../../utils/common-flags';
|
||||||
import * as ca from '../../utils/common-args';
|
import * as ca from '../../utils/common-args';
|
||||||
import { getBalenaSdk, getVisuals, stripIndent } from '../../utils/lazy';
|
import { getBalenaSdk, stripIndent } from '../../utils/lazy';
|
||||||
import { applicationIdInfo } from '../../utils/messages';
|
import { applicationIdInfo } from '../../utils/messages';
|
||||||
import { isV14 } from '../../utils/version';
|
import { isV14 } from '../../utils/version';
|
||||||
import type { DataOutputOptions } from '../../framework';
|
import type { DataOutputOptions } from '../../framework';
|
||||||
@ -99,23 +99,10 @@ export default class FleetCmd extends Command {
|
|||||||
application.device_type = application.is_for__device_type[0].slug;
|
application.device_type = application.is_for__device_type[0].slug;
|
||||||
application.commit = application.should_be_running__release[0]?.commit;
|
application.commit = application.should_be_running__release[0]?.commit;
|
||||||
|
|
||||||
if (isV14()) {
|
await this.outputData(
|
||||||
await this.outputData(
|
application,
|
||||||
application,
|
['app_name', 'id', 'device_type', 'slug', 'commit'],
|
||||||
['app_name', 'id', 'device_type', 'slug', 'commit'],
|
options,
|
||||||
options,
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
// Emulate table.vertical title output, but avoid uppercasing and inserting spaces
|
|
||||||
console.log(`== ${application.slug}`);
|
|
||||||
console.log(
|
|
||||||
getVisuals().table.vertical(application, [
|
|
||||||
'id',
|
|
||||||
'device_type',
|
|
||||||
'slug',
|
|
||||||
'commit',
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ import { flags } from '@oclif/command';
|
|||||||
|
|
||||||
import Command from '../command';
|
import Command from '../command';
|
||||||
import * as cf from '../utils/common-flags';
|
import * as cf from '../utils/common-flags';
|
||||||
import { getBalenaSdk, getVisuals, stripIndent } from '../utils/lazy';
|
import { getBalenaSdk, stripIndent } from '../utils/lazy';
|
||||||
import { isV14 } from '../utils/version';
|
import { isV14 } from '../utils/version';
|
||||||
import type { DataSetOutputOptions } from '../framework';
|
import type { DataSetOutputOptions } from '../framework';
|
||||||
|
|
||||||
@ -79,30 +79,17 @@ export default class FleetsCmd extends Command {
|
|||||||
application.device_type = application.is_for__device_type[0].slug;
|
application.device_type = application.is_for__device_type[0].slug;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isV14()) {
|
await this.outputData(
|
||||||
await this.outputData(
|
applications,
|
||||||
applications,
|
[
|
||||||
[
|
'id',
|
||||||
'id',
|
'app_name',
|
||||||
'app_name',
|
'slug',
|
||||||
'slug',
|
'device_type',
|
||||||
'device_type',
|
'device_count',
|
||||||
'device_count',
|
'online_devices',
|
||||||
'online_devices',
|
],
|
||||||
],
|
options,
|
||||||
options,
|
);
|
||||||
);
|
|
||||||
} else {
|
|
||||||
console.log(
|
|
||||||
getVisuals().table.horizontal(applications, [
|
|
||||||
'id',
|
|
||||||
'app_name => NAME',
|
|
||||||
'slug',
|
|
||||||
'device_type',
|
|
||||||
'online_devices',
|
|
||||||
'device_count',
|
|
||||||
]),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user