/
get.ts
40 lines (34 loc) · 1.01 KB
/
get.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { logError } from '@vertexvis/vertex-api-client';
import BaseGetCommand from '../../lib/base-get';
import { vertexClient } from '../../lib/client';
import { partGetter, getterFn } from '../../lib/getter';
export default class Get extends BaseGetCommand {
public static description = `Get a part.`;
public static examples = [
`$ vertex parts:get 54964c61-05d8-4f37-9638-18f7c4960c80
Id Name
54964c61-05d8-4f37-9638-18f7c4960c80 my-part
`,
];
public static args = [{ name: 'id' }];
public static flags = BaseGetCommand.flags;
public async run(): Promise<void> {
const {
args: { id },
flags: { extended, verbose },
} = this.parse(Get);
const basePath = this.parsedFlags?.basePath;
try {
return getterFn({
extended,
id,
getter: partGetter({
client: await vertexClient(basePath, this.userConfig),
verbose,
}),
});
} catch (error) {
logError(error, this.error);
}
}
}