Skip to content

Commit

Permalink
chore: clean up types
Browse files Browse the repository at this point in the history
  • Loading branch information
darlanalves committed May 5, 2024
1 parent dceda9b commit 0bd4aec
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
11 changes: 1 addition & 10 deletions src/containers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { exec } from '@cloud-cli/exec';
import { ServerParams, getConfig } from '@cloud-cli/cli';
import { findContainer, listContainers } from './store.js';
import { EnvList, addExecFlag, getEnvVars, getListFromString, readTargetName } from './utils.js';
import { Config, ExtraOptions } from './types.js';
import { Config, ContainerName, GetLogsOptions } from './types.js';

export async function getRunningContainers(): Promise<string[]> {
const ps = await exec('docker', ['ps', '--format', '{{.Names}}']);
Expand All @@ -14,15 +14,6 @@ export async function getRunningContainers(): Promise<string[]> {
return getListFromString(ps.stdout).sort();
}

interface GetLogsOptions extends ExtraOptions {
name: string;
lines?: string;
}

interface ContainerName extends ExtraOptions {
name: string;
}

export async function getLogs(options: GetLogsOptions): Promise<string> {
readTargetName(options);
const { name, lines } = options;
Expand Down
9 changes: 9 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,12 @@ export interface Container {
export interface ExtraOptions {
_?: string[];
}

export interface GetLogsOptions extends ExtraOptions {
name: string;
lines?: string;
}

export interface ContainerName extends ExtraOptions {
name: string;
}
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ function readPositionalArgs(args, name) {
if (!args[name]) {
args[name] = (args._ || []).shift();
}
}
}

0 comments on commit 0bd4aec

Please sign in to comment.