fix read file

This commit is contained in:
Saeed Vaziry
2024-04-14 17:53:08 +02:00
parent 72b37c56fd
commit 5ab6617b5d
5 changed files with 21 additions and 19 deletions

View File

@ -108,18 +108,22 @@ public function editFile(string $path, ?string $content = null): void
);
}
public function readFile(string $path, ?int $lastLines = null): string
public function readFile(string $path): string
{
$params = [
'path' => $path,
];
if ($lastLines !== null) {
$params['lines'] = $lastLines;
}
return $this->server->ssh()->exec(
$this->getScript('read-file.sh', $params)
$this->getScript('read-file.sh', [
'path' => $path,
])
);
}
public function tail(string $path, int $lines): string
{
return $this->server->ssh()->exec(
$this->getScript('tail.sh', [
'path' => $path,
'lines' => $lines,
])
);
}