add git log context fore relase note command
This commit is contained in:
parent
71a3125999
commit
59ba922472
@ -2,7 +2,7 @@ import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { logger } from '../util/logger';
|
||||
|
||||
import { runCommandStringArrayAndWriteOutput, CommandResult } from '../util/commonUtil';
|
||||
import { runCommandStringArrayAndWriteOutput, runCommandStringAndWriteOutputSync, CommandResult } from '../util/commonUtil';
|
||||
|
||||
|
||||
export interface CustomContext {
|
||||
@ -85,6 +85,9 @@ class CustomContexts {
|
||||
commandArray[index] = arg.replace('${CurDir}', contextDir);
|
||||
});
|
||||
|
||||
if (commandArray.length === 1) {
|
||||
return runCommandStringAndWriteOutputSync(commandArray[0], outputFile);
|
||||
}
|
||||
return await runCommandStringArrayAndWriteOutput(commandArray, outputFile);
|
||||
}
|
||||
}
|
||||
|
@ -180,4 +180,26 @@ export async function getLanguageIdByFileName(fileName: string): Promise<string
|
||||
|
||||
export function runCommand(command: string): string {
|
||||
return childProcess.execSync(command).toString();
|
||||
}
|
||||
|
||||
export function runCommandStringAndWriteOutputSync(command: string, outputFile: string): CommandResult {
|
||||
try {
|
||||
const options = {
|
||||
cwd: UiUtilWrapper.workspaceFoldersFirstPath() || '.'
|
||||
};
|
||||
const output = childProcess.execSync(command, options).toString();
|
||||
const onOutputFile = (command: string, stdout: string): string => {
|
||||
const data = {
|
||||
"command": command,
|
||||
"content": stdout,
|
||||
};
|
||||
return JSON.stringify(data);
|
||||
};
|
||||
fs.writeFileSync(outputFile, onOutputFile(command, output));
|
||||
return { exitCode: 0, stdout: output, stderr: '' }
|
||||
} catch (error) {
|
||||
logger.channel()?.error(`Error occurred: ${error}`);
|
||||
logger.channel()?.show();
|
||||
return { exitCode: 1, stdout: '', stderr: String(error) }
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "git_log_releasenote",
|
||||
"description": "git log for write release note",
|
||||
"command": ["git log $(git describe --tags --abbrev=0)..HEAD --pretty=format:\"%h - %B\""]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user