From d16b9030d4edb43fce4bbf4db4dad5e26d69f4b8 Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Fri, 26 Oct 2018 16:48:13 -0700 Subject: [PATCH 1/2] Remove color highlights from description and help text Closes https://github.com/netlify/cli/issues/137 --- src/commands/addons/index.js | 3 +-- src/commands/deploy.js | 3 +-- src/commands/functions/index.js | 3 +-- src/commands/init.js | 3 +-- src/commands/link.js | 3 +-- src/commands/login.js | 3 +-- src/commands/logout.js | 3 +-- src/commands/open/admin.js | 3 +-- src/commands/open/index.js | 3 +-- src/commands/open/site.js | 3 +-- src/commands/sites/create.js | 3 +-- src/commands/sites/index.js | 3 +-- src/commands/sites/list.js | 3 +-- src/commands/status/hooks.js | 3 +-- src/commands/status/index.js | 3 +-- src/commands/unlink.js | 3 +-- src/commands/watch.js | 3 +-- src/utils/renderShortDescription.js | 9 --------- 18 files changed, 17 insertions(+), 43 deletions(-) delete mode 100644 src/utils/renderShortDescription.js diff --git a/src/commands/addons/index.js b/src/commands/addons/index.js index 1593fe82be9..14678042375 100644 --- a/src/commands/addons/index.js +++ b/src/commands/addons/index.js @@ -1,5 +1,4 @@ const { Command } = require('@oclif/command') -const renderShortDesc = require('../../utils/renderShortDescription') const showHelp = require('../../utils/showHelp') const { isEmptyCommand } = require('../../utils/checkCommandInputs') @@ -15,7 +14,7 @@ class AddonsCommand extends Command { } } -AddonsCommand.description = `${renderShortDesc('Handle addon operations')} +AddonsCommand.description = `Handle addon operations The addons command will help you manage all your netlify addons ` diff --git a/src/commands/deploy.js b/src/commands/deploy.js index c009bfe90a9..acc745c0a27 100644 --- a/src/commands/deploy.js +++ b/src/commands/deploy.js @@ -1,5 +1,4 @@ const Command = require('../base') -const renderShortDesc = require('../utils/renderShortDescription') const openBrowser = require('../utils/open-browser') const path = require('path') const chalk = require('chalk') @@ -181,7 +180,7 @@ class DeployCommand extends Command { } } -DeployCommand.description = `${renderShortDesc(`Create a new deploy from the contents of a folder`)} +DeployCommand.description = `Create a new deploy from the contents of a folder Deploys from the build settings found in the netlify.toml file, or settings from the API. diff --git a/src/commands/functions/index.js b/src/commands/functions/index.js index 9a79804fc36..1d6ff5e5f09 100644 --- a/src/commands/functions/index.js +++ b/src/commands/functions/index.js @@ -2,7 +2,6 @@ const chalk = require('chalk') const { Command } = require('@oclif/command') const showHelp = require('../../utils/showHelp') const { isEmptyCommand } = require('../../utils/checkCommandInputs') -const renderShortDesc = require('../../utils/renderShortDescription') class FunctionsCommand extends Command { async run() { @@ -17,7 +16,7 @@ class FunctionsCommand extends Command { const name = chalk.greenBright(`\`functions\``) -FunctionsCommand.description = `${renderShortDesc('Manage netlify functions')} +FunctionsCommand.description = `Manage netlify functions The ${name} command will help you manage the functions in this site ` FunctionsCommand.examples = [ diff --git a/src/commands/init.js b/src/commands/init.js index ae497512773..badfb074db5 100644 --- a/src/commands/init.js +++ b/src/commands/init.js @@ -5,7 +5,6 @@ const Command = require('../base') const SitesWatchCommand = require('./watch') const configManual = require('../utils/init/config-manual') const configGithub = require('../utils/init/config-github') -const renderShortDesc = require('../utils/renderShortDescription') const getRepoData = require('../utils/getRepoData') const inquirer = require('inquirer') const SitesCreateCommand = require('./sites/create') @@ -231,7 +230,7 @@ git remote add origin https://github.com/YourUserName/RepoName.git } } -InitCommand.description = `${renderShortDesc('Configure continuous deployment for a new or existing site')}` +InitCommand.description = `Configure continuous deployment for a new or existing site` InitCommand.flags = { manual: flags.boolean({ diff --git a/src/commands/link.js b/src/commands/link.js index 4562c3f41f7..37e73c38e2e 100644 --- a/src/commands/link.js +++ b/src/commands/link.js @@ -1,6 +1,5 @@ const Command = require('../base') const { flags } = require('@oclif/command') -const renderShortDesc = require('../utils/renderShortDescription') const path = require('path') const chalk = require('chalk') const linkPrompt = require('../utils/link/link-by-prompt') @@ -97,7 +96,7 @@ class LinkCommand extends Command { } } -LinkCommand.description = `${renderShortDesc('Link a local repo or project folder to an existing site on Netlify')}` +LinkCommand.description = `Link a local repo or project folder to an existing site on Netlify` LinkCommand.examples = [ 'netlify link', diff --git a/src/commands/login.js b/src/commands/login.js index b8e616b614a..ce9a2ea0957 100644 --- a/src/commands/login.js +++ b/src/commands/login.js @@ -1,5 +1,4 @@ const Command = require('../base') -const renderShortDesc = require('../utils/renderShortDescription') const chalk = require('chalk') class LoginCommand extends Command { @@ -22,7 +21,7 @@ class LoginCommand extends Command { } } -LoginCommand.description = `${renderShortDesc('Login to your Netlify account')} +LoginCommand.description = `Login to your Netlify account Opens a web browser to acquire an OAuth token. Use NETLIFY_WEB_UI to set the base URL of the ticket URL. ` diff --git a/src/commands/logout.js b/src/commands/logout.js index da49a7e13a7..5701d997abb 100644 --- a/src/commands/logout.js +++ b/src/commands/logout.js @@ -1,5 +1,4 @@ const Command = require('../base') -const renderShortDesc = require('../utils/renderShortDescription') const { track } = require('../utils/telemetry') class LogoutCommand extends Command { @@ -20,7 +19,7 @@ class LogoutCommand extends Command { } } -LogoutCommand.description = `${renderShortDesc('Logout of your Netlify account')}` +LogoutCommand.description = `Logout of your Netlify account` LogoutCommand.hidden = true diff --git a/src/commands/open/admin.js b/src/commands/open/admin.js index 2a5acd84284..8320568d921 100644 --- a/src/commands/open/admin.js +++ b/src/commands/open/admin.js @@ -1,6 +1,5 @@ const Command = require('../../base') const openBrowser = require('../../utils/open-browser') -const renderShortDesc = require('../../utils/renderShortDescription') class OpenAdminCommand extends Command { async run() { @@ -42,7 +41,7 @@ Run \`netlify link\` to connect to this folder to a site`) } } -OpenAdminCommand.description = `${renderShortDesc('Opens current site admin UI in Netlify')}` +OpenAdminCommand.description = `Opens current site admin UI in Netlify` OpenAdminCommand.examples = ['netlify open:admin'] diff --git a/src/commands/open/index.js b/src/commands/open/index.js index d0400b067d8..39f50fbad86 100644 --- a/src/commands/open/index.js +++ b/src/commands/open/index.js @@ -1,6 +1,5 @@ const Command = require('../../base') const OpenAdminCommand = require('./admin') -const renderShortDesc = require('../../utils/renderShortDescription') const showHelp = require('../../utils/showHelp') const { isEmptyCommand } = require('../../utils/checkCommandInputs') @@ -16,7 +15,7 @@ class OpenCommand extends Command { } } -OpenCommand.description = `${renderShortDesc('Open settings for the site linked to the current folder')}` +OpenCommand.description = `Open settings for the site linked to the current folder` OpenCommand.examples = [ 'netlify open:admin', diff --git a/src/commands/open/site.js b/src/commands/open/site.js index 1130f703163..b21a3f1ea47 100644 --- a/src/commands/open/site.js +++ b/src/commands/open/site.js @@ -1,6 +1,5 @@ const Command = require('../../base') const openBrowser = require('../../utils/open-browser') -const renderShortDesc = require('../../utils/renderShortDescription') class OpenAdminCommand extends Command { async run() { @@ -35,7 +34,7 @@ Run \`netlify link\` to connect to this folder to a site`) } } -OpenAdminCommand.description = `${renderShortDesc('Opens current site url in browser')}` +OpenAdminCommand.description = `Opens current site url in browser` OpenAdminCommand.examples = ['netlify open:site'] diff --git a/src/commands/sites/create.js b/src/commands/sites/create.js index 3d5b1e280a5..37be12c7186 100644 --- a/src/commands/sites/create.js +++ b/src/commands/sites/create.js @@ -4,7 +4,6 @@ const isEmpty = require('lodash.isempty') const prettyjson = require('prettyjson') const chalk = require('chalk') const Command = require('../../base') -const renderShortDesc = require('../../utils/renderShortDescription') const { track } = require('../../utils/telemetry') class SitesCreateCommand extends Command { @@ -82,7 +81,7 @@ class SitesCreateCommand extends Command { } } -SitesCreateCommand.description = `${renderShortDesc('Create an empty site (advanced)')} +SitesCreateCommand.description = `Create an empty site (advanced) Create a blank site that isn't associated with any git remote. Does not link to the current working directory. ` diff --git a/src/commands/sites/index.js b/src/commands/sites/index.js index 28030b663e3..9fe2e946bf2 100644 --- a/src/commands/sites/index.js +++ b/src/commands/sites/index.js @@ -1,5 +1,4 @@ const { Command } = require('@oclif/command') -const renderShortDesc = require('../../utils/renderShortDescription') const showHelp = require('../../utils/showHelp') const { isEmptyCommand } = require('../../utils/checkCommandInputs') @@ -15,7 +14,7 @@ class SitesCommand extends Command { } } -SitesCommand.description = `${renderShortDesc('Handle various site operations')} +SitesCommand.description = `Handle various site operations The sites command will help you manage all your sites ` diff --git a/src/commands/sites/list.js b/src/commands/sites/list.js index d45ab32310a..802f78a949d 100644 --- a/src/commands/sites/list.js +++ b/src/commands/sites/list.js @@ -1,7 +1,6 @@ const { flags } = require('@oclif/command') const chalk = require('chalk') const Command = require('../../base') -const renderShortDesc = require('../../utils/renderShortDescription') class SitesListCommand extends Command { async run() { @@ -60,7 +59,7 @@ class SitesListCommand extends Command { } } -SitesListCommand.description = `${renderShortDesc('List all sites you have access to')}` +SitesListCommand.description = `List all sites you have access to` SitesListCommand.flags = { json: flags.boolean({ diff --git a/src/commands/status/hooks.js b/src/commands/status/hooks.js index 47b1153d39b..a6251f32fb4 100644 --- a/src/commands/status/hooks.js +++ b/src/commands/status/hooks.js @@ -1,5 +1,4 @@ const Command = require('../../base') -const renderShortDesc = require('../../utils/renderShortDescription') const prettyjson = require('prettyjson') const get = require('lodash.get') @@ -51,6 +50,6 @@ Site Hook Status │ } } -StatusHooksCommand.description = `${renderShortDesc('Print hook information of the linked site')}` +StatusHooksCommand.description = `Print hook information of the linked site` module.exports = StatusHooksCommand diff --git a/src/commands/status/index.js b/src/commands/status/index.js index 21071623ba6..1a9664aaf76 100644 --- a/src/commands/status/index.js +++ b/src/commands/status/index.js @@ -1,5 +1,4 @@ const Command = require('../../base') -const renderShortDesc = require('../../utils/renderShortDescription') const prettyjson = require('prettyjson') const get = require('lodash.get') const chalk = require('chalk') @@ -78,6 +77,6 @@ class StatusCommand extends Command { } } -StatusCommand.description = `${renderShortDesc('Print status information')}` +StatusCommand.description = `Print status information` module.exports = StatusCommand diff --git a/src/commands/unlink.js b/src/commands/unlink.js index ed63936a088..c452629ec8d 100644 --- a/src/commands/unlink.js +++ b/src/commands/unlink.js @@ -1,5 +1,4 @@ const Command = require('../base') -const renderShortDesc = require('../utils/renderShortDescription') const { track } = require('../utils/telemetry') class UnlinkCommand extends Command { @@ -29,6 +28,6 @@ class UnlinkCommand extends Command { } } -UnlinkCommand.description = `${renderShortDesc('Unlink a local folder from a Netlify site')}` +UnlinkCommand.description = `Unlink a local folder from a Netlify site` module.exports = UnlinkCommand diff --git a/src/commands/watch.js b/src/commands/watch.js index 7467c47d990..9367fef209b 100644 --- a/src/commands/watch.js +++ b/src/commands/watch.js @@ -4,7 +4,6 @@ const pWaitFor = require('p-wait-for') const cli = require('cli-ux').default const prettyjson = require('prettyjson') const chalk = require('chalk') -const renderShortDesc = require('../utils/renderShortDescription') class SitesWatchCommand extends Command { async run() { @@ -63,7 +62,7 @@ class SitesWatchCommand extends Command { } } -SitesWatchCommand.description = `${renderShortDesc('Watch for site deploy to finish')}` +SitesWatchCommand.description = `Watch for site deploy to finish` SitesWatchCommand.examples = [ `netlify watch`, diff --git a/src/utils/renderShortDescription.js b/src/utils/renderShortDescription.js deleted file mode 100644 index d72df109325..00000000000 --- a/src/utils/renderShortDescription.js +++ /dev/null @@ -1,9 +0,0 @@ -const chalk = require('chalk') - -module.exports = function shortDescription(description) { - // If building docs don't use chalk - if (process.env.DOCS_GEN) { - return description - } - return chalk.cyan(description) -} From f6839a5b82dce37dae543d8e2a1aad0909a4934a Mon Sep 17 00:00:00 2001 From: Bret Comnes Date: Tue, 4 Dec 2018 16:54:55 -0800 Subject: [PATCH 2/2] Add help plugin back in Since we no longer have the colorizing issue to worry about, we can add this back in and have it listed in the commands, which is a slight improvement over not having it listed. --- package.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 041012f4ae9..3382e3ef14b 100644 --- a/package.json +++ b/package.json @@ -49,9 +49,9 @@ "@oclif/command": "^1", "@oclif/config": "^1", "@oclif/errors": "^1.1.2", - "@oclif/plugin-help": "^2", - "@oclif/plugin-plugins": "^1.7.3", + "@oclif/plugin-help": "^2.1.4", "@oclif/plugin-not-found": "^1.1.4", + "@oclif/plugin-plugins": "^1.7.3", "@octokit/rest": "^16.1.0", "ascii-table": "0.0.9", "chalk": "^2.4.1", @@ -127,7 +127,8 @@ "commands": "./src/commands", "plugins": [ "@oclif/plugin-not-found", - "@oclif/plugin-plugins" + "@oclif/plugin-plugins", + "@oclif/plugin-help" ], "hooks": { "init": [