Initial Commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { defineCommand } from "citty";
|
||||
import { listDeployments } from "../lib/shared";
|
||||
import { toTable } from "../lib/format";
|
||||
|
||||
export const ps = defineCommand({
|
||||
meta: {
|
||||
name: "ps",
|
||||
description: "List deployments",
|
||||
},
|
||||
args: {
|
||||
all: {
|
||||
type: "boolean",
|
||||
alias: "a",
|
||||
description:
|
||||
"Show all stopped deployments (including those created by the run command)",
|
||||
},
|
||||
},
|
||||
async run({ args: { all } }) {
|
||||
console.log(
|
||||
toTable(
|
||||
(await listDeployments())
|
||||
.filter((d) => all || d.status?.replicas)
|
||||
.map((d) => ({
|
||||
name: d.metadata?.name,
|
||||
status: `${d.status?.availableReplicas}/${d.status?.replicas}`,
|
||||
})),
|
||||
),
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1,26 @@
|
||||
import { defineCommand } from "citty";
|
||||
import { ctx } from "../lib/context";
|
||||
import { serviceToDeployment } from "../lib/convert";
|
||||
|
||||
export const up = defineCommand({
|
||||
meta: {
|
||||
name: "up",
|
||||
description: "Create and start deployments",
|
||||
},
|
||||
args: {
|
||||
build: {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
alias: "b",
|
||||
description: "Build images before starting deployments",
|
||||
negativeDescription: "Don't build an image, even if it's policy",
|
||||
},
|
||||
},
|
||||
async run() {
|
||||
const { project, compose } = ctx();
|
||||
const cmp = await compose();
|
||||
console.dir(serviceToDeployment(project, "app", cmp.services!.app!), {
|
||||
depth: 999,
|
||||
});
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user