MCPcopy Index your code
hub / github.com/cloudgraphdev/cli / add

Function add

src/commands/operation.ts:30–70  ·  view source on GitHub ↗
(type: PluginType)

Source from the content-addressed store, hash-verified

28 }
29
30 async add(type: PluginType): Promise<
31 {
32 key: string
33 version: string
34 plugin: any
35 }[]
36 > {
37 const { argv } = await this.parse(OperationBaseCommand)
38 const allPlugins = argv
39 const manager = await this.getPluginManager(type)
40 const addedPlugins = []
41
42 if (isEmpty(allPlugins)) {
43 this.logger.info(
44 `No ${messages[type]?.plural} were passed as a parameter.`
45 )
46 }
47
48 for (let key of allPlugins) {
49 let version = 'latest'
50 if (key.includes('@')) {
51 [key, version] = key.split('@')
52 }
53 const plugin = await manager.getPlugin(key, version)
54
55 // Only shows for certain plugins
56 configurationLogs.includes(type) &&
57 this.logger.info(
58 `Run ${chalk.italic.green(
59 `$cg init ${key}`
60 )} to setup configuration for this ${messages[type]?.singular}`
61 )
62
63 addedPlugins.push({
64 key,
65 version,
66 plugin,
67 })
68 }
69 return addedPlugins
70 }
71
72 async installPlugin(type: PluginType): Promise<void> {
73 const manager = await this.getPluginManager(type)

Callers

nothing calls this directly

Calls 2

getPluginMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected