mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-04-24 21:09:54 +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
|
- Application
|
||||||
|
|
||||||
- [apps](#apps)
|
- [apps](#apps)
|
||||||
- [app <name>](#app-name)
|
- [app <nameorslug>](#app-nameorslug)
|
||||||
- [app create <name>](#app-create-name)
|
- [app create <name>](#app-create-name)
|
||||||
- [app purge <name>](#app-purge-name)
|
- [app purge <name>](#app-purge-name)
|
||||||
- [app rename <name> [newname]](#app-rename-name-newname)
|
- [app rename <name> [newname]](#app-rename-name-newname)
|
||||||
@ -324,19 +324,20 @@ Examples:
|
|||||||
|
|
||||||
No-op since release v12.0.0
|
No-op since release v12.0.0
|
||||||
|
|
||||||
## app <name>
|
## app <nameOrSlug>
|
||||||
|
|
||||||
Display detailed information about a single balena application.
|
Display detailed information about a single balena application.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
|
||||||
$ balena app MyApp
|
$ balena app MyApp
|
||||||
|
$ balena app myorg/myapp
|
||||||
|
|
||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
#### NAME
|
#### NAMEORSLUG
|
||||||
|
|
||||||
application name or numeric ID
|
application name or org/name slug
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ interface FlagsDef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface ArgsDef {
|
interface ArgsDef {
|
||||||
name: string;
|
nameOrSlug: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class AppCmd extends Command {
|
export default class AppCmd extends Command {
|
||||||
@ -35,17 +35,17 @@ export default class AppCmd extends Command {
|
|||||||
|
|
||||||
Display detailed information about a single balena application.
|
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 = [
|
public static args = [
|
||||||
{
|
{
|
||||||
name: 'name',
|
name: 'nameOrSlug',
|
||||||
description: 'application name or numeric ID',
|
description: 'application name or org/name slug',
|
||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
public static usage = 'app <name>';
|
public static usage = 'app <nameOrSlug>';
|
||||||
|
|
||||||
public static flags: flags.Input<FlagsDef> = {
|
public static flags: flags.Input<FlagsDef> = {
|
||||||
help: cf.help,
|
help: cf.help,
|
||||||
@ -59,22 +59,29 @@ export default class AppCmd extends Command {
|
|||||||
|
|
||||||
const { getApplication } = await import('../../utils/sdk');
|
const { getApplication } = await import('../../utils/sdk');
|
||||||
|
|
||||||
const application = (await getApplication(getBalenaSdk(), params.name, {
|
const application = (await getApplication(
|
||||||
$expand: {
|
getBalenaSdk(),
|
||||||
is_for__device_type: { $select: 'slug' },
|
params.nameOrSlug,
|
||||||
should_be_running__release: { $select: 'commit' },
|
{
|
||||||
|
$expand: {
|
||||||
|
is_for__device_type: { $select: 'slug' },
|
||||||
|
should_be_running__release: { $select: 'commit' },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
})) as ApplicationWithDeviceType & {
|
)) as ApplicationWithDeviceType & {
|
||||||
should_be_running__release: [Release?];
|
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;
|
application.device_type = application.is_for__device_type[0].slug;
|
||||||
// @ts-expect-error
|
|
||||||
application.commit = application.should_be_running__release[0]?.commit;
|
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(
|
console.log(
|
||||||
getVisuals().table.vertical(application, [
|
getVisuals().table.vertical(application, [
|
||||||
`$${application.app_name}$`,
|
|
||||||
'id',
|
'id',
|
||||||
'device_type',
|
'device_type',
|
||||||
'slug',
|
'slug',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user