wip: cli git parsing
This commit is contained in:
parent
a42342b99d
commit
4a4eea5e91
@ -1,18 +1,8 @@
|
||||
const GITFORMAT = `--pretty=format:{
|
||||
"commit": "%h",
|
||||
"parent": "%p",
|
||||
"refs": "%D",
|
||||
"subject": "%s",
|
||||
"notes": "%N",
|
||||
"body": "%b",
|
||||
"author": { "name": "%aN", "email": "%aE", "date": "%ad" },
|
||||
"commiter": { "name": "%cN", "email": "%cE", "date": "%cd" }
|
||||
},`
|
||||
const GITFORMAT = `--pretty=format:{%n "commit": "%h",%n "parent": "%p",%n "refs": "%D",%n "subject": "%s",%n "notes": "%N",%n "body": "%b",%n "author": { "name": "%aN", "email": "%aE", "date": "%ad" },%n "commiter": { "name": "%cN", "email": "%cE", "date": "%cd" }%n},`
|
||||
export const git_log = async (
|
||||
from: string | undefined,
|
||||
to = 'HEAD',
|
||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||
): Promise<any[]> => {
|
||||
): Promise<boolean> => {
|
||||
// https://git-scm.com/docs/pretty-formats
|
||||
const r = await Bun.spawn([
|
||||
'git',
|
||||
@ -24,22 +14,8 @@ export const git_log = async (
|
||||
'--date=iso',
|
||||
])
|
||||
const text = await new Response(r.stdout).text()
|
||||
console.log(text)
|
||||
r /* eturn text
|
||||
.split('----\n')
|
||||
.splice(1)
|
||||
.map((line) => {
|
||||
const [firstLine, , ..._body] = line.split('\n')
|
||||
const [message, shortHash, authorName, date, authorEmail] =
|
||||
firstLine.split('|')
|
||||
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
|
||||
const r: any = {
|
||||
date,
|
||||
message,
|
||||
shortHash,
|
||||
author: { name: authorName, email: authorEmail },
|
||||
body: _body.join('\n'),
|
||||
}
|
||||
return r
|
||||
}) */
|
||||
// console.log(JSON.parse('[' + text.slice(0, -1) + ']'))
|
||||
// const str = JSON.stringify(`[${text.slice(0, -1)}]`)
|
||||
// console.log(JSON.parse(str))
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user