swaggerhub-cli 0.6.4 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +535 -291
  2. package/bin/run +3 -3
  3. package/oclif.manifest.json +1165 -1
  4. package/package.json +19 -26
  5. package/src/commands/api/create.js +12 -11
  6. package/src/commands/api/delete.js +9 -8
  7. package/src/commands/api/get.js +10 -9
  8. package/src/commands/api/publish.js +12 -9
  9. package/src/commands/api/setdefault.js +8 -6
  10. package/src/commands/api/unpublish.js +8 -6
  11. package/src/commands/api/update.js +12 -11
  12. package/src/commands/api/validate.js +41 -12
  13. package/src/commands/domain/create.js +12 -11
  14. package/src/commands/domain/delete.js +9 -8
  15. package/src/commands/domain/get.js +9 -8
  16. package/src/commands/domain/publish.js +8 -6
  17. package/src/commands/domain/setdefault.js +8 -6
  18. package/src/commands/domain/unpublish.js +8 -6
  19. package/src/commands/domain/update.js +12 -11
  20. package/src/commands/integration/create.js +10 -9
  21. package/src/commands/integration/delete.js +8 -6
  22. package/src/commands/integration/execute.js +8 -6
  23. package/src/commands/integration/get.js +8 -6
  24. package/src/commands/integration/list.js +11 -10
  25. package/src/commands/integration/update.js +9 -8
  26. package/src/commands/project/api/add.js +10 -12
  27. package/src/commands/project/api/remove.js +10 -11
  28. package/src/commands/project/create.js +11 -10
  29. package/src/commands/project/delete.js +8 -6
  30. package/src/commands/project/domain/add.js +10 -12
  31. package/src/commands/project/domain/remove.js +10 -11
  32. package/src/commands/project/get.js +8 -6
  33. package/src/commands/project/list.js +10 -9
  34. package/src/commands/project/member/list.js +10 -9
  35. package/src/config/index.js +1 -2
  36. package/src/help.js +1 -1
  37. package/src/index.js +2 -1
  38. package/src/support/command/base-command.js +2 -2
  39. package/src/support/command/handle-response.js +1 -1
  40. package/src/support/command/parse-input.js +1 -1
  41. package/src/support/command/update-command.js +1 -1
  42. package/src/support/http/index.js +1 -3
  43. package/src/support/isOnPrem.js +10 -0
  44. package/src/utils/definitions.js +4 -2
  45. package/src/utils/general.js +29 -1
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
2
3
  const BaseCommand = require('../../support/command/base-command')
3
4
  const UpdateCommand = require('../../support/command/update-command')
@@ -5,7 +6,7 @@ const UpdateCommand = require('../../support/command/update-command')
5
6
  class SetDefaultDomainCommand extends UpdateCommand {
6
7
 
7
8
  async run() {
8
- const { args } = this.parse(SetDefaultDomainCommand)
9
+ const { args } = await this.parse(SetDefaultDomainCommand)
9
10
  const domainPath = getDomainIdentifierArg(args)
10
11
  const [owner, name, version] = splitPathParams(domainPath)
11
12
 
@@ -19,11 +20,12 @@ SetDefaultDomainCommand.examples = [
19
20
  'swaggerhub domain:setdefault organization/domain/2.0.0'
20
21
  ]
21
22
 
22
- SetDefaultDomainCommand.args = [{
23
- name: 'OWNER/DOMAIN_NAME/VERSION',
24
- required: true,
25
- description: 'domain identifier'
26
- }]
23
+ SetDefaultDomainCommand.args = {
24
+ 'OWNER/DOMAIN_NAME/VERSION': Args.string({
25
+ required: true,
26
+ description: 'Domain to set as default on SwaggerHub'
27
+ })
28
+ }
27
29
 
28
30
  SetDefaultDomainCommand.flags = BaseCommand.flags
29
31
 
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
2
3
  const BaseCommand = require('../../support/command/base-command')
3
4
  const UpdateCommand = require('../../support/command/update-command')
@@ -5,7 +6,7 @@ const UpdateCommand = require('../../support/command/update-command')
5
6
  class UnpublishCommand extends UpdateCommand {
6
7
 
7
8
  async run() {
8
- const { args } = this.parse(UnpublishCommand)
9
+ const { args } = await this.parse(UnpublishCommand)
9
10
  const domainPath = getDomainIdentifierArg(args)
10
11
  const [owner, name, version] = splitPathParams(domainPath)
11
12
 
@@ -19,11 +20,12 @@ UnpublishCommand.examples = [
19
20
  'swaggerhub domain:unpublish organization/domain/1.0.0'
20
21
  ]
21
22
 
22
- UnpublishCommand.args = [{
23
- name: 'OWNER/DOMAIN_NAME/VERSION',
24
- required: true,
25
- description: 'Domain identifier'
26
- }]
23
+ UnpublishCommand.args = {
24
+ 'OWNER/DOMAIN_NAME/VERSION': Args.string({
25
+ required: true,
26
+ description: 'Domain to unpublish on SwaggerHub'
27
+ })
28
+ }
27
29
 
28
30
  UnpublishCommand.flags = BaseCommand.flags
29
31
 
@@ -1,4 +1,4 @@
1
- const { flags } = require('@oclif/command')
1
+ const { Flags, Args } = require('@oclif/core')
2
2
  const { readFileSync } = require('fs-extra')
3
3
  const { getDomain, postDomain } = require('../../requests/domain')
4
4
  const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
@@ -30,7 +30,7 @@ class UpdateDomainCommand extends UpdateCommand {
30
30
  }
31
31
 
32
32
  async run() {
33
- const { args, flags } = this.parse(UpdateDomainCommand)
33
+ const { args, flags } = await this.parse(UpdateDomainCommand)
34
34
 
35
35
  if (!Object.keys(flags).length) {
36
36
  return this.error('No updates specified', { exit: 1 })
@@ -77,29 +77,30 @@ UpdateDomainCommand.examples = [
77
77
  'swaggerhub domain:update organization/domain/1.0.0 --visibility=private',
78
78
  ]
79
79
 
80
- UpdateDomainCommand.args = [{
81
- name: 'OWNER/DOMAIN_NAME/[VERSION]',
82
- required: true,
83
- description: 'domain to update in SwaggerHub'
84
- }]
80
+ UpdateDomainCommand.args = {
81
+ 'OWNER/DOMAIN_NAME/[VERSION]': Args.string({
82
+ required: true,
83
+ description: 'Domain to update on SwaggerHub'
84
+ })
85
+ }
85
86
 
86
87
  UpdateDomainCommand.flags = {
87
- file: flags.string({
88
+ file: Flags.string({
88
89
  char: 'f',
89
90
  description: 'file location of domain to update',
90
91
  required: false,
91
92
  multiple: false
92
93
  }),
93
- visibility: flags.string({
94
+ visibility: Flags.string({
94
95
  description: 'visibility of domain in SwaggerHub',
95
96
  options: ['public', 'private']
96
97
  }),
97
- published: flags.string({
98
+ published: Flags.string({
98
99
  description: 'sets the lifecycle setting of the domain version',
99
100
  options: ['publish', 'unpublish'],
100
101
  required: false
101
102
  }),
102
- setdefault: flags.boolean({
103
+ setdefault: Flags.boolean({
103
104
  description: 'sets domain version to be the default',
104
105
  required: false
105
106
  }),
@@ -1,4 +1,4 @@
1
- const { flags } = require('@oclif/command')
1
+ const { Flags, Args } = require('@oclif/core')
2
2
  const { postApi } = require('../../requests/api')
3
3
  const { getApiIdentifierArg, readConfigFile } = require('../../support/command/parse-input')
4
4
  const BaseCommand = require('../../support/command/base-command')
@@ -6,7 +6,7 @@ const BaseCommand = require('../../support/command/base-command')
6
6
  class CreateIntegrationCommand extends BaseCommand {
7
7
 
8
8
  async run() {
9
- const { args, flags } = this.parse(CreateIntegrationCommand)
9
+ const { args, flags } = await this.parse(CreateIntegrationCommand)
10
10
  const config = readConfigFile(flags.file)
11
11
 
12
12
  const requestedApiPath = getApiIdentifierArg(args)
@@ -29,7 +29,7 @@ class CreateIntegrationCommand extends BaseCommand {
29
29
  }
30
30
 
31
31
  CreateIntegrationCommand.description = `creates a new API integration from a JSON configuration file.
32
- See the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/master/examples/integrations
32
+ See the documentation for configuration files: https://github.com/SmartBear/swaggerhub-cli/tree/main/examples/integrations
33
33
  When VERSION is not included in the argument, the integration will be added to be default API version.
34
34
  `
35
35
 
@@ -37,14 +37,15 @@ CreateIntegrationCommand.examples = [
37
37
  'swaggerhub integration:create organization/api/1.0.0 --file config.json'
38
38
  ]
39
39
 
40
- CreateIntegrationCommand.args = [{
41
- name: 'OWNER/API_NAME/[VERSION]',
42
- required: true,
43
- description: 'API where integration will be added'
44
- }]
40
+ CreateIntegrationCommand.args = {
41
+ 'OWNER/API_NAME/[VERSION]': Args.string({
42
+ required: true,
43
+ description: 'API to add integration to on SwaggerHub'
44
+ })
45
+ }
45
46
 
46
47
  CreateIntegrationCommand.flags = {
47
- file: flags.string({
48
+ file: Flags.string({
48
49
  char: 'f',
49
50
  description: 'location of integration configuration file',
50
51
  required: true
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { deleteApi } = require('../../requests/api')
2
3
  const { getIntegrationIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
4
  const BaseCommand = require('../../support/command/base-command')
@@ -5,7 +6,7 @@ const BaseCommand = require('../../support/command/base-command')
5
6
  class DeleteIntegrationCommand extends BaseCommand {
6
7
 
7
8
  async run() {
8
- const { args } = this.parse(DeleteIntegrationCommand)
9
+ const { args } = await this.parse(DeleteIntegrationCommand)
9
10
  const integrationPath = getIntegrationIdentifierArg(args)
10
11
  await this.deleteIntegration(integrationPath)
11
12
  }
@@ -27,11 +28,12 @@ DeleteIntegrationCommand.examples = [
27
28
  'swaggerhub integration:delete organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704'
28
29
  ]
29
30
 
30
- DeleteIntegrationCommand.args = [{
31
- name: 'OWNER/API_NAME/VERSION/INTEGRATION_ID',
32
- required: true,
33
- description: 'Integration to delete'
34
- }]
31
+ DeleteIntegrationCommand.args = {
32
+ 'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
33
+ required: true,
34
+ description: 'Integration to delete for given API on Swaggerhub'
35
+ })
36
+ }
35
37
 
36
38
  DeleteIntegrationCommand.flags = {
37
39
  ...BaseCommand.flags
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { postApi } = require('../../requests/api')
2
3
  const { getIntegrationIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
4
  const BaseCommand = require('../../support/command/base-command')
@@ -5,7 +6,7 @@ const BaseCommand = require('../../support/command/base-command')
5
6
  class ExecuteIntegrationCommand extends BaseCommand {
6
7
 
7
8
  async run() {
8
- const { args } = this.parse(ExecuteIntegrationCommand)
9
+ const { args } = await this.parse(ExecuteIntegrationCommand)
9
10
  const integrationPath = getIntegrationIdentifierArg(args)
10
11
  await this.executeIntegration(integrationPath)
11
12
  }
@@ -27,11 +28,12 @@ ExecuteIntegrationCommand.examples = [
27
28
  'swaggerhub integration:execute organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704'
28
29
  ]
29
30
 
30
- ExecuteIntegrationCommand.args = [{
31
- name: 'OWNER/API_NAME/VERSION/INTEGRATION_ID',
32
- required: true,
33
- description: 'Integration to execute for given API'
34
- }]
31
+ ExecuteIntegrationCommand.args = {
32
+ 'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
33
+ required: true,
34
+ description: 'Integration to execute for given API on Swaggerhub'
35
+ })
36
+ }
35
37
 
36
38
  ExecuteIntegrationCommand.flags = {
37
39
  ...BaseCommand.flags
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { getApi } = require('../../requests/api')
2
3
  const { getIntegrationIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
4
  const { getResponseContent } = require('../../support/command/handle-response')
@@ -11,7 +12,7 @@ class GetIntegrationCommand extends BaseCommand {
11
12
  }
12
13
 
13
14
  async run() {
14
- const { args } = this.parse(GetIntegrationCommand)
15
+ const { args } = await this.parse(GetIntegrationCommand)
15
16
  const integrationPath = getIntegrationIdentifierArg(args)
16
17
  await this.getIntegration(integrationPath)
17
18
  }
@@ -38,11 +39,12 @@ GetIntegrationCommand.examples = [
38
39
  'swaggerhub integration:get organization/api/1.0.0/503c2db6-448a-4678-a310-f465429e9704'
39
40
  ]
40
41
 
41
- GetIntegrationCommand.args = [{
42
- name: 'OWNER/API_NAME/VERSION/INTEGRATION_ID',
43
- required: true,
44
- description: 'Integration to fetch for given API'
45
- }]
42
+ GetIntegrationCommand.args = {
43
+ 'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
44
+ required: true,
45
+ description: 'Integration to fetch for given API on Swaggerhub'
46
+ })
47
+ }
46
48
 
47
49
  GetIntegrationCommand.flags = {
48
50
  ...BaseCommand.flags
@@ -1,4 +1,4 @@
1
- const { cli } = require('cli-ux')
1
+ const { ux, Args } = require('@oclif/core')
2
2
  const { getApi } = require('../../requests/api')
3
3
  const { getResponseContent } = require('../../support/command/handle-response')
4
4
  const { getApiIdentifierArg } = require('../../support/command/parse-input')
@@ -11,15 +11,15 @@ class ListIntegrationCommand extends BaseCommand {
11
11
  }
12
12
 
13
13
  async run() {
14
- const { args } = this.parse(ListIntegrationCommand)
14
+ const { args } = await this.parse(ListIntegrationCommand)
15
15
  const requestedApiPath = getApiIdentifierArg(args)
16
16
  const apiPath = await this.ensureVersion(requestedApiPath)
17
17
  await this.listIntegrations(apiPath)
18
18
  }
19
19
 
20
20
  async logIntegration(response) {
21
- const responseObj = JSON.parse(await getResponseContent(response))
22
- cli.table(responseObj.integrations, {
21
+ const { integrations } = JSON.parse(await getResponseContent(response))
22
+ ux.table(integrations, {
23
23
  id: {
24
24
  header: 'ID',
25
25
  minWidth: 38
@@ -30,7 +30,7 @@ class ListIntegrationCommand extends BaseCommand {
30
30
  },
31
31
  enabled: {}
32
32
  }, {
33
- printLine: this.log
33
+ printLine: this.log.bind(this)
34
34
  })
35
35
  }
36
36
 
@@ -49,11 +49,12 @@ ListIntegrationCommand.examples = [
49
49
  'swaggerhub integration:list organization/api/1.0.0'
50
50
  ]
51
51
 
52
- ListIntegrationCommand.args = [{
53
- name: 'OWNER/API_NAME/[VERSION]',
54
- required: true,
55
- description: 'API to list integrations on'
56
- }]
52
+ ListIntegrationCommand.args = {
53
+ 'OWNER/API_NAME/[VERSION]': Args.string({
54
+ required: true,
55
+ description: 'API to list integrations for on Swaggerhub'
56
+ })
57
+ }
57
58
 
58
59
  ListIntegrationCommand.flags = {
59
60
  ...BaseCommand.flags
@@ -1,4 +1,4 @@
1
- const { flags } = require('@oclif/command')
1
+ const { Flags, Args } = require('@oclif/core')
2
2
  const { putApi } = require('../../requests/api')
3
3
  const { getIntegrationIdentifierArg, readConfigFile, splitPathParams } = require('../../support/command/parse-input')
4
4
  const BaseCommand = require('../../support/command/base-command')
@@ -6,7 +6,7 @@ const BaseCommand = require('../../support/command/base-command')
6
6
  class UpdateIntegrationCommand extends BaseCommand {
7
7
 
8
8
  async run() {
9
- const { args, flags } = this.parse(UpdateIntegrationCommand)
9
+ const { args, flags } = await this.parse(UpdateIntegrationCommand)
10
10
  const integrationPath = getIntegrationIdentifierArg(args)
11
11
  const config = readConfigFile(flags.file)
12
12
  await this.updateIntegration(integrationPath, config)
@@ -33,14 +33,15 @@ UpdateIntegrationCommand.examples = [
33
33
  'swaggerhub integration:update organization/api/1.0.0/503c2db6-448a-4678-abcd-0123456789abc --file config.json'
34
34
  ]
35
35
 
36
- UpdateIntegrationCommand.args = [{
37
- name: 'OWNER/API_NAME/VERSION/INTEGRATION_ID',
38
- required: true,
39
- description: 'Integration to update on the given API'
40
- }]
36
+ UpdateIntegrationCommand.args = {
37
+ 'OWNER/API_NAME/VERSION/INTEGRATION_ID': Args.string({
38
+ required: true,
39
+ description: 'Integration to update for given API on Swaggerhub'
40
+ })
41
+ }
41
42
 
42
43
  UpdateIntegrationCommand.flags = {
43
- file: flags.string({
44
+ file: Flags.string({
44
45
  char: 'f',
45
46
  description: 'location of integration configuration file',
46
47
  required: true
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { putProject } = require('../../../requests/project')
2
3
  const {
3
4
  getProjectIdentifierArg
@@ -7,7 +8,7 @@ const BaseCommand = require('../../../support/command/base-command')
7
8
  class ProjectApiAddCommand extends BaseCommand {
8
9
 
9
10
  async run() {
10
- const { args } = this.parse(ProjectApiAddCommand)
11
+ const { args } = await this.parse(ProjectApiAddCommand)
11
12
  const projectPath = getProjectIdentifierArg(args)
12
13
  const apiName = args['API']
13
14
 
@@ -31,18 +32,15 @@ ProjectApiAddCommand.examples = [
31
32
  'swaggerhub project:api:add organization/project_name my_api'
32
33
  ]
33
34
 
34
- ProjectApiAddCommand.args = [
35
- {
36
- name: 'OWNER/PROJECT_NAME',
35
+ ProjectApiAddCommand.args = {
36
+ 'OWNER/PROJECT_NAME': Args.string({
37
37
  required: true,
38
- description: 'The project to add the API to'
39
- },
40
-
41
- {
42
- name: 'API',
38
+ description: 'The project to add the API to on Swaggerhub'
39
+ }),
40
+ 'API': Args.string({
43
41
  required: true,
44
- description: 'The name of the API to add'
45
- }
46
- ]
42
+ description: 'The name of the API on Swaggerhub to add'
43
+ })
44
+ }
47
45
 
48
46
  module.exports = ProjectApiAddCommand
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { putProject, getProject } = require('../../../requests/project')
2
3
  const {
3
4
  getProjectIdentifierArg,
@@ -10,7 +11,7 @@ const { pipeAsync } = require('../../../utils/general')
10
11
  class ProjectApiRemoveCommand extends BaseCommand {
11
12
 
12
13
  async run() {
13
- const { args } = this.parse(ProjectApiRemoveCommand)
14
+ const { args } = await this.parse(ProjectApiRemoveCommand)
14
15
  const projectPath = getProjectIdentifierArg(args)
15
16
  const apiToRemove = args['API']
16
17
 
@@ -53,17 +54,15 @@ ProjectApiRemoveCommand.examples = [
53
54
  'swaggerhub project:api:remove organization/project_name my_api',
54
55
  ]
55
56
 
56
- ProjectApiRemoveCommand.args = [
57
- {
58
- name: 'OWNER/PROJECT_NAME',
57
+ ProjectApiRemoveCommand.args = {
58
+ 'OWNER/PROJECT_NAME': Args.string({
59
59
  required: true,
60
- description: 'The project remove the API from'
61
- },
62
- {
63
- name: 'API',
60
+ description: 'The project to remove the API from on Swaggerhub'
61
+ }),
62
+ 'API': Args.string({
64
63
  required: true,
65
- description: 'The API to remove'
66
- }
67
- ]
64
+ description: 'The name of the API on Swaggerhub to remove'
65
+ })
66
+ }
68
67
 
69
68
  module.exports = ProjectApiRemoveCommand
@@ -1,4 +1,4 @@
1
- const { flags } = require('@oclif/command')
1
+ const { Flags, Args } = require('@oclif/core')
2
2
  const { postProject } = require('../../requests/project')
3
3
  const {
4
4
  getProjectIdentifierArg,
@@ -10,7 +10,7 @@ const BaseCommand = require('../../support/command/base-command')
10
10
  class CreateProjectCommand extends BaseCommand {
11
11
 
12
12
  async run() {
13
- const { args, flags } = this.parse(CreateProjectCommand)
13
+ const { args, flags } = await this.parse(CreateProjectCommand)
14
14
  const projectPath = getProjectIdentifierArg(args)
15
15
  const [owner, name] = splitPathParams(projectPath)
16
16
  const body = {
@@ -50,23 +50,24 @@ CreateProjectCommand.examples = [
50
50
  'swaggerhub project:create organization/new_project_name -a "testapi1" -d "testdomain3" --description "description"'
51
51
  ]
52
52
 
53
- CreateProjectCommand.args = [{
54
- name: 'OWNER/PROJECT_NAME',
55
- required: true,
56
- description: 'The new project to create'
57
- }]
53
+ CreateProjectCommand.args = {
54
+ 'OWNER/PROJECT_NAME': Args.string({
55
+ required: true,
56
+ description: 'The new project to create on Swaggerhub'
57
+ })
58
+ }
58
59
 
59
60
  CreateProjectCommand.flags = {
60
- description: flags.string({
61
+ description: Flags.string({
61
62
  description: 'Description of project',
62
63
  required: false
63
64
  }),
64
- apis: flags.string({
65
+ apis: Flags.string({
65
66
  char: 'a',
66
67
  description: 'Comma separated list of api names to include in project',
67
68
  required: false
68
69
  }),
69
- domains: flags.string({
70
+ domains: Flags.string({
70
71
  char: 'd',
71
72
  description: 'Comma separated list of domain names to include in project',
72
73
  required: false
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { deleteProject } = require('../../requests/project')
2
3
  const { getProjectIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
4
  const BaseCommand = require('../../support/command/base-command')
@@ -9,7 +10,7 @@ class DeleteProjectCommand extends BaseCommand {
9
10
  }
10
11
 
11
12
  async run() {
12
- const { args } = this.parse(DeleteProjectCommand)
13
+ const { args } = await this.parse(DeleteProjectCommand)
13
14
  const projectPath = getProjectIdentifierArg(args)
14
15
  await this.deleteProject(projectPath)
15
16
  }
@@ -31,11 +32,12 @@ DeleteProjectCommand.examples = [
31
32
  'swaggerhub project:delete organization/project_name'
32
33
  ]
33
34
 
34
- DeleteProjectCommand.args = [{
35
- name: 'OWNER/PROJECT_NAME',
36
- required: true,
37
- description: 'Project to delete'
38
- }]
35
+ DeleteProjectCommand.args = {
36
+ 'OWNER/PROJECT_NAME': Args.string({
37
+ required: true,
38
+ description: 'The project to delete on Swaggerhub'
39
+ })
40
+ }
39
41
 
40
42
  DeleteProjectCommand.flags = {
41
43
  ...BaseCommand.flags
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { putProject } = require('../../../requests/project')
2
3
  const {
3
4
  getProjectIdentifierArg
@@ -7,7 +8,7 @@ const BaseCommand = require('../../../support/command/base-command')
7
8
  class ProjectDomainAddCommand extends BaseCommand {
8
9
 
9
10
  async run() {
10
- const { args } = this.parse(ProjectDomainAddCommand)
11
+ const { args } = await this.parse(ProjectDomainAddCommand)
11
12
  const projectPath = getProjectIdentifierArg(args)
12
13
  const domainName = args['DOMAIN']
13
14
 
@@ -31,18 +32,15 @@ ProjectDomainAddCommand.examples = [
31
32
  'swaggerhub project:domain:add organization/project_name my_domain'
32
33
  ]
33
34
 
34
- ProjectDomainAddCommand.args = [
35
- {
36
- name: 'OWNER/PROJECT_NAME',
35
+ ProjectDomainAddCommand.args = {
36
+ 'OWNER/PROJECT_NAME': Args.string({
37
37
  required: true,
38
- description: 'The project to add the domain to'
39
- },
40
-
41
- {
42
- name: 'DOMAIN',
38
+ description: 'The project to add the domain to on Swaggerhub'
39
+ }),
40
+ 'DOMAIN': Args.string({
43
41
  required: true,
44
- description: 'The name of the domain to add'
45
- }
46
- ]
42
+ description: 'The name of the domain on Swaggerhub to add'
43
+ })
44
+ }
47
45
 
48
46
  module.exports = ProjectDomainAddCommand
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { putProject, getProject } = require('../../../requests/project')
2
3
  const {
3
4
  getProjectIdentifierArg,
@@ -10,7 +11,7 @@ const { pipeAsync } = require('../../../utils/general')
10
11
  class ProjectDomainRemoveCommand extends BaseCommand {
11
12
 
12
13
  async run() {
13
- const { args } = this.parse(ProjectDomainRemoveCommand)
14
+ const { args } = await this.parse(ProjectDomainRemoveCommand)
14
15
  const projectPath = getProjectIdentifierArg(args)
15
16
  const domainToRemove = args['DOMAIN']
16
17
 
@@ -53,17 +54,15 @@ ProjectDomainRemoveCommand.examples = [
53
54
  'swaggerhub project:domain:remove organization/project_name my_domain',
54
55
  ]
55
56
 
56
- ProjectDomainRemoveCommand.args = [
57
- {
58
- name: 'OWNER/PROJECT_NAME',
57
+ ProjectDomainRemoveCommand.args = {
58
+ 'OWNER/PROJECT_NAME': Args.string({
59
59
  required: true,
60
- description: 'The project remove the domain from'
61
- },
62
- {
63
- name: 'DOMAIN',
60
+ description: 'The project to remove the domain from on Swaggerhub'
61
+ }),
62
+ 'DOMAIN': Args.string({
64
63
  required: true,
65
- description: 'The domain to remove'
66
- }
67
- ]
64
+ description: 'The name of the domain on Swaggerhub to remove'
65
+ })
66
+ }
68
67
 
69
68
  module.exports = ProjectDomainRemoveCommand
@@ -1,3 +1,4 @@
1
+ const { Args } = require('@oclif/core')
1
2
  const { getProject } = require('../../requests/project')
2
3
  const { getProjectIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
3
4
  const { getResponseContent } = require('../../support/command/handle-response')
@@ -11,7 +12,7 @@ class GetProjectCommand extends BaseCommand {
11
12
  }
12
13
 
13
14
  async run() {
14
- const { args } = this.parse(GetProjectCommand)
15
+ const { args } = await this.parse(GetProjectCommand)
15
16
  const projectPath = getProjectIdentifierArg(args)
16
17
  await this.getProject(projectPath)
17
18
  }
@@ -38,11 +39,12 @@ GetProjectCommand.examples = [
38
39
  'swaggerhub project:get organization/project_name'
39
40
  ]
40
41
 
41
- GetProjectCommand.args = [{
42
- name: 'OWNER/PROJECT_NAME',
43
- required: true,
44
- description: 'Project to retrieve the details for'
45
- }]
42
+ GetProjectCommand.args = {
43
+ 'OWNER/PROJECT_NAME': Args.string({
44
+ required: true,
45
+ description: 'The project to get details for on Swaggerhub'
46
+ })
47
+ }
46
48
 
47
49
  GetProjectCommand.flags = {
48
50
  ...BaseCommand.flags