/
setdefault.js
32 lines (24 loc) · 1 KB
/
setdefault.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { Args } = require('@oclif/core')
const { getDomainIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
const BaseCommand = require('../../support/command/base-command')
const UpdateCommand = require('../../support/command/update-command')
class SetDefaultDomainCommand extends UpdateCommand {
async run() {
const { args } = await this.parse(SetDefaultDomainCommand)
const domainPath = getDomainIdentifierArg(args)
const [owner, name, version] = splitPathParams(domainPath)
await this.updateDefault('domains', owner, name, version)
}
}
SetDefaultDomainCommand.description = 'set the default version of a domain'
SetDefaultDomainCommand.examples = [
'swaggerhub domain:setdefault organization/domain/2.0.0'
]
SetDefaultDomainCommand.args = {
'OWNER/DOMAIN_NAME/VERSION': Args.string({
required: true,
description: 'Domain to set as default on SwaggerHub'
})
}
SetDefaultDomainCommand.flags = BaseCommand.flags
module.exports = SetDefaultDomainCommand