Skip to content

Commit

Permalink
Deprecate --plugin-dir option in cli
Browse files Browse the repository at this point in the history
  • Loading branch information
kimjoar committed Dec 4, 2017
1 parent 86f4437 commit 8ea1703
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/cli_plugin/install/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Logger from '../lib/logger';
import { getConfig } from '../../server/path';
import { parse, parseMilliseconds } from './settings';
import logWarnings from '../lib/log_warnings';
import { warnIfUsingPluginDirOption } from '../lib/warn_if_plugin_dir_option';

function processCommand(command, options) {
let settings;
Expand All @@ -16,6 +17,8 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);

warnIfUsingPluginDirOption(options, fromRoot('plugins'), logger);
logWarnings(settings, logger);
install(settings, logger);
}
Expand All @@ -37,7 +40,7 @@ export default function pluginInstall(program) {
)
.option(
'-d, --plugin-dir <path>',
'path to the directory where plugins are stored',
'path to the directory where plugins are stored (DEPRECATED, known to not work for all plugins)',
fromRoot('plugins')
)
.description('install a plugin',
Expand Down
8 changes: 8 additions & 0 deletions src/cli_plugin/lib/warn_if_plugin_dir_option.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export function warnIfUsingPluginDirOption(options, defaultValue, logger) {
if (options.pluginDir !== defaultValue) {
logger.log(
'Warning: Using the -d, --plugin-dir option is deprecated, and is ' +
'known to not work for all plugins, including X-Pack.'
);
}
}
5 changes: 4 additions & 1 deletion src/cli_plugin/list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import list from './list';
import Logger from '../lib/logger';
import { parse } from './settings';
import logWarnings from '../lib/log_warnings';
import { warnIfUsingPluginDirOption } from '../lib/warn_if_plugin_dir_option';

function processCommand(command, options) {
let settings;
Expand All @@ -15,6 +16,8 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);

warnIfUsingPluginDirOption(options, fromRoot('plugins'), logger);
logWarnings(settings, logger);
list(settings, logger);
}
Expand All @@ -24,7 +27,7 @@ export default function pluginList(program) {
.command('list')
.option(
'-d, --plugin-dir <path>',
'path to the directory where plugins are stored',
'path to the directory where plugins are stored (DEPRECATED, known to not work for all plugins)',
fromRoot('plugins')
)
.description('list installed plugins')
Expand Down
5 changes: 4 additions & 1 deletion src/cli_plugin/remove/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import Logger from '../lib/logger';
import { parse } from './settings';
import { getConfig } from '../../server/path';
import logWarnings from '../lib/log_warnings';
import { warnIfUsingPluginDirOption } from '../lib/warn_if_plugin_dir_option';

function processCommand(command, options) {
let settings;
Expand All @@ -16,6 +17,8 @@ function processCommand(command, options) {
}

const logger = new Logger(settings);

warnIfUsingPluginDirOption(options, fromRoot('plugins'), logger);
logWarnings(settings, logger);
remove(settings, logger);
}
Expand All @@ -32,7 +35,7 @@ export default function pluginRemove(program) {
)
.option(
'-d, --plugin-dir <path>',
'path to the directory where plugins are stored',
'path to the directory where plugins are stored (DEPRECATED, known to not work for all plugins)',
fromRoot('plugins')
)
.description('remove a plugin',
Expand Down

0 comments on commit 8ea1703

Please sign in to comment.