Enhance installation and update processes with user confirmation and GPU detection; add required packages
This commit is contained in:
+22
-14
@@ -3,20 +3,28 @@ import { install } from "./install.js";
|
||||
import { update } from "./update.js";
|
||||
import { remove } from "./remove.js";
|
||||
|
||||
const { positionals } = parseArgs({ allowPositionals: true });
|
||||
const { positionals, values } = parseArgs({
|
||||
allowPositionals: true,
|
||||
options: { yes: { type: "boolean", short: "y", default: false } },
|
||||
});
|
||||
const [command] = positionals;
|
||||
|
||||
switch (command) {
|
||||
case "install":
|
||||
await install();
|
||||
break;
|
||||
case "update":
|
||||
await update();
|
||||
break;
|
||||
case "remove":
|
||||
await remove();
|
||||
break;
|
||||
default:
|
||||
console.error("Usage: dotfiles <install|update|remove>");
|
||||
process.exit(1);
|
||||
try {
|
||||
switch (command) {
|
||||
case "install":
|
||||
await install({ yes: values.yes });
|
||||
break;
|
||||
case "update":
|
||||
await update({ yes: values.yes });
|
||||
break;
|
||||
case "remove":
|
||||
await remove();
|
||||
break;
|
||||
default:
|
||||
console.error("Usage: dotfiles <install|update|remove> [-y|--yes]");
|
||||
process.exit(1);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(`\nError: ${(err as Error).message}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user