fix: systeme metrics chart
This commit is contained in:
@@ -30,27 +30,23 @@ function parseLines(output: string): string[] {
|
||||
.filter(Boolean)
|
||||
}
|
||||
|
||||
function quoteDir(pathValue: string) {
|
||||
return shellQuote(pathValue)
|
||||
}
|
||||
|
||||
async function listRemoteFiles(remoteDir: string): Promise<string[]> {
|
||||
const output = await runSsh(
|
||||
`cd ${quoteDir(remoteDir)} && ls -1A | sort -r | head -n ${MAX_FILES_PER_FOLDER}`
|
||||
`cd ${shellQuote(remoteDir)} && ls -1A | sort -r | head -n ${MAX_FILES_PER_FOLDER}`
|
||||
)
|
||||
return parseLines(output)
|
||||
}
|
||||
|
||||
async function listRemoteDirs(remoteRoot: string): Promise<string[]> {
|
||||
const output = await runSsh(
|
||||
`cd ${quoteDir(remoteRoot)} && for d in */; do [ -d "$d" ] && printf '%s\n' "\${d%/}"; done`
|
||||
`cd ${shellQuote(remoteRoot)} && for d in */; do [ -d "$d" ] && printf '%s\n' "\${d%/}"; done`
|
||||
)
|
||||
return parseLines(output)
|
||||
}
|
||||
|
||||
async function getLatestRemoteFile(remoteDir: string): Promise<string | null> {
|
||||
const output = await runSsh(
|
||||
`cd ${quoteDir(remoteDir)} && ls -1A | sort -r | head -n 1`
|
||||
`cd ${shellQuote(remoteDir)} && ls -1A | sort -r | head -n 1`
|
||||
)
|
||||
const files = parseLines(output)
|
||||
return files[0] || null
|
||||
|
||||
Reference in New Issue
Block a user