Skip to content

Commit

Permalink
add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
joshmossas committed Jun 4, 2024
1 parent 2e292f3 commit 1a72b8a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tooling/cli/src/_main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ import build from "./commands/build";
import codegen from "./commands/codegen";
import dev from "./commands/dev";
import init from "./commands/init";
import version from "./commands/version";

const main = defineCommand({
subCommands: {
build,
dev,
codegen,
dev,
init,
version,
},
});

Expand Down
25 changes: 25 additions & 0 deletions tooling/cli/src/commands/version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";

import { defineCommand } from "citty";
import path from "pathe";

const __filename = fileURLToPath(import.meta.url); // get the resolved path to the file
const __dirname = path.dirname(__filename); // get the name of the directory

const version = defineCommand({
meta: {
name: "Version",
description: "Get the current Arri CLI version",
},
run() {
const packageJson = JSON.parse(
readFileSync(path.resolve(__dirname, "../package.json"), {
encoding: "utf8",
}),
);
console.info(`${packageJson.version}`);
},
});

export default version;

0 comments on commit 1a72b8a

Please sign in to comment.