Skip to content

Instantly share code, notes, and snippets.

@Souvikns
Created February 12, 2022 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Souvikns/1dff19a056e1f3680e65d1294a036fda to your computer and use it in GitHub Desktop.
Save Souvikns/1dff19a056e1f3680e65d1294a036fda to your computer and use it in GitHub Desktop.
import {main, options} from '@asyncapi/diff/cli';
import Command from '../base';
import {flags} from '@oclif/command';
export default class Diff extends Command {
static flags = options.getFlags(flags);
static args = options.args;
async run(){
const {args, flags} = this.parse(Diff);
await main(args, flags);
}
}
export async function main(args, flags){
const firstDocumentPath = args['old'];
const secondDocumentPath = args['new'];
const outputFormat = flags['format'];
const outputType = flags['type'];
const overrideFilePath = flags['overrides'];
// Logic as diff requriements
}
export options = {
args: [
{
name: 'old',
description: 'old spec path, URL or context-name',
required: true,
},
{
name: 'new',
description: 'new spec path, URL or context-name',
required: true,
},
];
getFlags: (flags) => ({
help: flags.help({ char: 'h' }),
format: flags.string({
char: 'f',
description: 'format of the output',
default: 'json',
options: ['json'],
}),
type: flags.string({
char: 't',
description: 'type of the output',
default: 'all',
options: ['breaking', 'non-breaking', 'unclassified', 'all'],
}),
overrides: flags.string({
char: 'o',
description: 'path to JSON file containing the override properties',
}),
};)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment