mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 18:56:25 +00:00
Merge pull request #2125 from balena-io/fix-app-display
Fix app name output in app command
This commit is contained in:
commit
532c4a1862
@ -162,7 +162,7 @@ Users are encouraged to regularly update the balena CLI to the latest version.
|
||||
- Application
|
||||
|
||||
- [apps](#apps)
|
||||
- [app <name>](#app-name)
|
||||
- [app <nameorslug>](#app-nameorslug)
|
||||
- [app create <name>](#app-create-name)
|
||||
- [app purge <name>](#app-purge-name)
|
||||
- [app rename <name> [newname]](#app-rename-name-newname)
|
||||
@ -324,19 +324,20 @@ Examples:
|
||||
|
||||
No-op since release v12.0.0
|
||||
|
||||
## app <name>
|
||||
## app <nameOrSlug>
|
||||
|
||||
Display detailed information about a single balena application.
|
||||
|
||||
Examples:
|
||||
|
||||
$ balena app MyApp
|
||||
$ balena app myorg/myapp
|
||||
|
||||
### Arguments
|
||||
|
||||
#### NAME
|
||||
#### NAMEORSLUG
|
||||
|
||||
application name or numeric ID
|
||||
application name or org/name slug
|
||||
|
||||
### Options
|
||||
|
||||
|
@ -26,7 +26,7 @@ interface FlagsDef {
|
||||
}
|
||||
|
||||
interface ArgsDef {
|
||||
name: string;
|
||||
nameOrSlug: string;
|
||||
}
|
||||
|
||||
export default class AppCmd extends Command {
|
||||
@ -35,17 +35,17 @@ export default class AppCmd extends Command {
|
||||
|
||||
Display detailed information about a single balena application.
|
||||
`;
|
||||
public static examples = ['$ balena app MyApp'];
|
||||
public static examples = ['$ balena app MyApp', '$ balena app myorg/myapp'];
|
||||
|
||||
public static args = [
|
||||
{
|
||||
name: 'name',
|
||||
description: 'application name or numeric ID',
|
||||
name: 'nameOrSlug',
|
||||
description: 'application name or org/name slug',
|
||||
required: true,
|
||||
},
|
||||
];
|
||||
|
||||
public static usage = 'app <name>';
|
||||
public static usage = 'app <nameOrSlug>';
|
||||
|
||||
public static flags: flags.Input<FlagsDef> = {
|
||||
help: cf.help,
|
||||
@ -59,22 +59,29 @@ export default class AppCmd extends Command {
|
||||
|
||||
const { getApplication } = await import('../../utils/sdk');
|
||||
|
||||
const application = (await getApplication(getBalenaSdk(), params.name, {
|
||||
$expand: {
|
||||
is_for__device_type: { $select: 'slug' },
|
||||
should_be_running__release: { $select: 'commit' },
|
||||
const application = (await getApplication(
|
||||
getBalenaSdk(),
|
||||
params.nameOrSlug,
|
||||
{
|
||||
$expand: {
|
||||
is_for__device_type: { $select: 'slug' },
|
||||
should_be_running__release: { $select: 'commit' },
|
||||
},
|
||||
},
|
||||
})) as ApplicationWithDeviceType & {
|
||||
)) as ApplicationWithDeviceType & {
|
||||
should_be_running__release: [Release?];
|
||||
// For display purposes:
|
||||
device_type: string;
|
||||
commit?: string;
|
||||
};
|
||||
|
||||
// @ts-expect-error
|
||||
application.device_type = application.is_for__device_type[0].slug;
|
||||
// @ts-expect-error
|
||||
application.commit = application.should_be_running__release[0]?.commit;
|
||||
|
||||
// Emulate table.vertical title output, but avoid uppercasing and inserting spaces
|
||||
console.log(`== ${application.app_name}`);
|
||||
console.log(
|
||||
getVisuals().table.vertical(application, [
|
||||
`$${application.app_name}$`,
|
||||
'id',
|
||||
'device_type',
|
||||
'slug',
|
||||
|
Loading…
Reference in New Issue
Block a user