Skip to content

Commit

Permalink
fix: cannot tail logs from command
Browse files Browse the repository at this point in the history
  • Loading branch information
skanehira committed Jul 10, 2024
1 parent 4c2ccd2 commit 38ac500
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 6 additions & 3 deletions denops/docker/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,12 @@ export async function main(denops: Denops): Promise<void> {
}
},

async tailContainerLogs() {
const name = (await getContainer(denops)).Names[0];
await docker.tailContainerLogs(denops, name);
async tailContainerLogs(name?: unknown) {
let cname = name as string;
if (!name) {
cname = (await getContainer(denops)).Names[0];
}
await docker.tailContainerLogs(denops, cname);
},

async inspectImage() {
Expand Down
5 changes: 2 additions & 3 deletions denops/docker/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Container, Image, SearchImage } from "./types.ts";
import { Denops } from "./deps.ts";
import { vars } from "./deps.ts";
import { Denops, vars } from "./deps.ts";

// from https://stackoverflow.com/questions/15900485/correct-way-to-convert-size-in-bytes-to-kb-mb-gb-in-javascript
export function formatBytes(bytes: number, decimals?: number) {
Expand Down Expand Up @@ -38,7 +37,7 @@ export async function getEntry<T>(denops: Denops, varname: string): Promise<T> {
varname,
) as T[];
if (!entries || entries.length === 0) {
throw new Error("no images");
throw new Error(`No ${varname} found`);
}
const idx = (await denops.call("line", ".") as number) - 2;
return entries[idx];
Expand Down

0 comments on commit 38ac500

Please sign in to comment.