Browse Source

Made usage information work for all commands

master
Leo Lamprecht 7 years ago
parent
commit
9b36c27598
  1. 7
      src/now.js
  2. 6
      src/providers/sh/commands/deploy.js
  3. 2
      src/providers/sh/commands/list.js
  4. 4
      src/providers/sh/commands/logout.js
  5. 2
      src/providers/sh/commands/logs.js
  6. 2
      src/providers/sh/commands/remove.js
  7. 2
      src/providers/sh/commands/upgrade.js
  8. 4
      src/providers/sh/commands/whoami.js

7
src/now.js

@ -305,13 +305,6 @@ const main = async (argv_): Promise<number> => {
}
}
// we special case help because it's a generic command with
// information about all providers
if (!suppliedProvider && argv.help) {
console.log(getHelp(defaultProvider, providers))
return 0
}
const provider: Object = providers[suppliedProvider || defaultProvider]
let subcommand

6
src/providers/sh/commands/deploy.js

@ -70,7 +70,7 @@ const mriOpts = {
const help = () => {
console.log(`
${chalk.bold(`${logo()} now`)} [options] <command | path>
${chalk.bold(`${logo} now`)} [options] <command | path>
${chalk.dim('Commands:')}
@ -99,6 +99,10 @@ const help = () => {
login Login into your account or creates a new one
logout Logout from your account
${chalk.dim('Providers')}
sh, aws, gcp [cmd] Deploy using a different provider
${chalk.dim('Options:')}
-h, --help Output usage information

2
src/providers/sh/commands/list.js

@ -73,7 +73,7 @@ const main = async ctx => {
debug = argv.debug
apiUrl = argv.apiUrl || 'https://api.zeit.co'
if (argv.help) {
if (argv.help || app === 'help') {
help()
process.exit(0)
}

4
src/providers/sh/commands/logout.js

@ -50,7 +50,9 @@ const main = async ctx => {
apiUrl = argv.url || 'https://api.zeit.co'
endpoint = apiUrl + '/www/user/tokens/'
if (argv.help) {
argv._ = argv._.slice(1)
if (argv.help || argv._[0] === 'help') {
help()
process.exit(0)
}

2
src/providers/sh/commands/logs.js

@ -90,7 +90,7 @@ const main = async ctx => {
argv._ = argv._.slice(1)
deploymentIdOrURL = argv._[0]
if (argv.help || !deploymentIdOrURL) {
if (argv.help || !deploymentIdOrURL || deploymentIdOrURL === 'help') {
help()
process.exit(0)
}

2
src/providers/sh/commands/remove.js

@ -88,7 +88,7 @@ const main = async ctx => {
skipConfirmation = argv.yes || false
ids = argv._
if (argv.help || ids.length === 0) {
if (argv.help || ids.length === 0 || ids[0] === 'help') {
help()
process.exit(0)
}

2
src/providers/sh/commands/upgrade.js

@ -86,7 +86,7 @@ const main = async ctx => {
debug = argv.debug
apiUrl = argv.url || 'https://api.zeit.co'
if (argv.help) {
if (argv.help || argv._[0] === 'help') {
help()
exit(0)
}

4
src/providers/sh/commands/whoami.js

@ -47,12 +47,14 @@ const main = async ctx => {
}
})
argv._ = argv._.slice(1)
if (!ctx.authConfig.credentials.length) {
console.log(getWelcome('sh', providers))
return 0
}
if (argv.help) {
if (argv.help || argv._[0] === 'help') {
help()
process.exit(0)
}

Loading…
Cancel
Save