From de88007704b997747da0cb7932b9269e292b56a5 Mon Sep 17 00:00:00 2001 From: TsvetanMilanov Date: Thu, 7 Apr 2016 11:24:31 +0300 Subject: [PATCH] Add message when no plugins found with tns plugin find When there are no plugins found with tns plugin find/search command the cli should show message for no plugins found instead of showing empty table with headers. --- lib/commands/plugin/find-plugins.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/commands/plugin/find-plugins.ts b/lib/commands/plugin/find-plugins.ts index 59053e9731..795fbee3ca 100644 --- a/lib/commands/plugin/find-plugins.ts +++ b/lib/commands/plugin/find-plugins.ts @@ -28,7 +28,6 @@ export class FindPluginsCommand implements ICommand { this.$progressIndicator.showProgressIndicator(pluginsFuture, 500).wait(); let plugins: IDictionary = pluginsFuture.get(); - this.$logger.out("Available NativeScript plugins"); this.showPlugins(plugins).wait(); }).future()(); } @@ -43,6 +42,11 @@ export class FindPluginsCommand implements ICommand { return (() => { let allPluginsNames: string[] = _.keys(plugins).sort(); + if (!allPluginsNames || !allPluginsNames.length) { + this.$logger.warn("No plugins found."); + return; + } + let count: number = this.$options.count || FindPluginsCommand.COUNT_OF_PLUGINS_TO_DISPLAY; if (!isInteractive() || this.$options.all) { @@ -54,6 +58,8 @@ export class FindPluginsCommand implements ICommand { let pluginsToDisplay: string[] = allPluginsNames.splice(0, count); let shouldDisplayMorePlugins: boolean = true; + this.$logger.out("Available NativeScript plugins:"); + do { data = this.createTableCells(plugins, pluginsToDisplay);