Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions src/commands/set-url.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Args } from '@oclif/core'
import { S3 } from '../storage/s3'
import BaseCommand from '../base/base-command'
import ui from '../services/ui'

export default class SetUrl extends BaseCommand {
static description = 'update the API spec URL in api-config.json'

static examples = [
'$ codex set-url https://api.example.com/swagger.json',
]

static flags = { ...BaseCommand.flags }

static args = {
url: Args.string({
required: true,
description: 'new API spec URL',
})
}

async run() {
const storage = new S3()
const apiConfig = await storage.getApiConfig()
const oldUrl = apiConfig.specUrl

apiConfig.specUrl = this.args.url
await storage.writeApiConfig(apiConfig)

ui.info(`spec URL updated: ${oldUrl} → ${this.args.url}`)
}
}
Loading