+async function updatePluginCLI (options: any) {
+ if (!options['path'] && !options['npmName']) {
+ console.error('You need to specify the npm name or the path of the plugin you want to update.\n')
+ program.outputHelp()
+ process.exit(-1)
+ }
+
+ if (options['path'] && !isAbsolute(options['path'])) {
+ console.error('Path should be absolute.')
+ process.exit(-1)
+ }
+
+ const { url, username, password } = await getServerCredentials(options)
+ const accessToken = await getAdminTokenOrDie(url, username, password)
+
+ try {
+ await updatePlugin({
+ url,
+ accessToken,
+ npmName: options['npmName'],
+ path: options['path']
+ })
+ } catch (err) {
+ console.error('Cannot update plugin.', err)
+ process.exit(-1)
+ return
+ }
+
+ console.log('Plugin updated.')
+ process.exit(0)
+}
+