diff --git a/src/mod.ts b/src/mod.ts index ab192e1..2870935 100644 --- a/src/mod.ts +++ b/src/mod.ts @@ -2,6 +2,7 @@ export * from "./constants.ts"; export * from "./context.ts"; export * from "./db.ts"; export * from "./network.ts"; +export * from "./oras.ts"; export * from "./state.ts"; export * from "./types.ts"; export * from "./utils.ts"; diff --git a/src/oras.ts b/src/oras.ts new file mode 100644 index 0000000..2e58784 --- /dev/null +++ b/src/oras.ts @@ -0,0 +1,15 @@ +export async function setupOrasBinary(version: string): Promise { + const process = new Deno.Command("oras", { + args: ["version"], + stdout: "piped", + stderr: "piped", + }) + .spawn(); + + const { code } = await process.output(); + if (code === 0) { + return; + } + + console.log(`Downloading ORAS version ${version}...`); +} diff --git a/src/subcommands/pull.ts b/src/subcommands/pull.ts new file mode 100644 index 0000000..084ea01 --- /dev/null +++ b/src/subcommands/pull.ts @@ -0,0 +1,2 @@ +export default async function (name: string): Promise { +} diff --git a/src/subcommands/push.ts b/src/subcommands/push.ts new file mode 100644 index 0000000..084ea01 --- /dev/null +++ b/src/subcommands/push.ts @@ -0,0 +1,2 @@ +export default async function (name: string): Promise { +} diff --git a/src/subcommands/registry/login.ts b/src/subcommands/registry/login.ts new file mode 100644 index 0000000..87618ab --- /dev/null +++ b/src/subcommands/registry/login.ts @@ -0,0 +1,5 @@ +import { setupOrasBinary } from "../../oras.ts"; + +export default async function () { + await setupOrasBinary(Deno.env.get("ORAS_VERSION") ?? "1.3.0"); +}