From c11e17573334dfb487a8e1cc25fa84fa9e138f5c Mon Sep 17 00:00:00 2001 From: Lily <129828376+Soccera1@users.noreply.github.com> Date: Tue, 28 Jul 2026 16:12:21 +1000 Subject: Refactor coreutils into single-call command modules (#1) * Refactor to single call --- src/commands/arch.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/commands/arch.js (limited to 'src/commands/arch.js') diff --git a/src/commands/arch.js b/src/commands/arch.js new file mode 100644 index 0000000..e72b00f --- /dev/null +++ b/src/commands/arch.js @@ -0,0 +1,18 @@ +#!/usr/bin/env bun + +import { helpVersionOnlyMetaOption, localeQuotedEscapedDiagnostic, machineName, normalizeHelpVersionOnlyLongOptions, parseOptions } from "../shared/common.js"; +import { UsageError, stdout } from "../shared/diagnostics.js"; +import { defineCommand, runAsMain } from "../shared/command.js"; + +export async function arch(args) { + args = normalizeHelpVersionOnlyLongOptions(args); + const { operands } = parseOptions(args, { long: { help: false, version: false } }); + if (operands.length) throw new UsageError(`extra operand ${localeQuotedEscapedDiagnostic(operands[0])}`, true); + stdout(`${machineName()}\n`); + return 0; +} + +const singleCall = defineCommand("arch", arch, helpVersionOnlyMetaOption); +export default singleCall; + +if (import.meta.main) await runAsMain(singleCall); -- cgit v1.3