Add CLI command to import configuration from file or stdin, providing an alternative to the env-var-based automatic import on startup. Features: - `import-config --config <path>` to import from a mounted file - `import-config --stdin` to import from piped input (no file mount needed) - `import-config --dry-run` to validate config without importing Changes: - Add app/server/cli/commands/import-config.ts with new command - Register importConfigCommand in CLI index - Refactor config-import.ts: extract runImport() and add applyConfigImport() for direct config object import (used by CLI) - Update docs with both import methods (env var and CLI examples)
23 lines
673 B
TypeScript
23 lines
673 B
TypeScript
import { Command } from "commander";
|
|
import { importConfigCommand } from "./commands/import-config";
|
|
import { resetPasswordCommand } from "./commands/reset-password";
|
|
|
|
const program = new Command();
|
|
|
|
program.name("zerobyte").description("Zerobyte CLI - Backup automation tool built on top of Restic").version("1.0.0");
|
|
program.addCommand(importConfigCommand);
|
|
program.addCommand(resetPasswordCommand);
|
|
|
|
export async function runCLI(argv: string[]): Promise<boolean> {
|
|
const args = argv.slice(2);
|
|
const hasCommand = args.length > 0 && !args[0].startsWith("-");
|
|
|
|
if (!hasCommand) {
|
|
return false;
|
|
}
|
|
|
|
await program.parseAsync(argv);
|
|
return true;
|
|
}
|
|
|
|
export { program };
|