-
-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support context file location in repository
- Loading branch information
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import {Flags} from '@oclif/core'; | ||
import Command from '../../../base'; | ||
import { editContext } from '../../../models/Context'; | ||
|
||
export default class ContextEdit extends Command { | ||
static description='Edit a context in the store'; | ||
static flags = { | ||
help: Flags.help({char: 'h'}) | ||
}; | ||
|
||
static args = [ | ||
{name: 'context-name', description: 'context name', required: true}, | ||
{name: 'spec-file-path', description: 'file path of the spec file', required: true} | ||
]; | ||
|
||
async run() { | ||
const {args} = await this.parse(ContextEdit); | ||
const contextName = args['context-name']; | ||
const specFilePath = args['spec-file-path']; | ||
|
||
await editContext(contextName, specFilePath); | ||
this.log(`Edited context "${contextName}".\n\nYou can set it as your current context: asyncapi config context use ${contextName}\nYou can use this context when needed by passing ${contextName} as a parameter: asyncapi validate ${contextName}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters