UNPKG

@nesardramos/fmg

Version:

A CLI tool to manage path aliases in your terminal.

32 lines (27 loc) 975 B
// commands/remove.js const fs = require("fs"); const path = require("path"); const os = require("os"); const functionsFilePath = path.join(os.homedir(), ".fmg-functions.sh"); const completionFilePath = path.join(os.homedir(), ".fmg-completion.zsh"); exports.command = "remove"; exports.describe = "Removes the shell functions and completion script files."; exports.handler = (argv) => { try { if (fs.existsSync(functionsFilePath)) { fs.unlinkSync(functionsFilePath); console.log(`Shell functions file removed: ${functionsFilePath}`); } if (fs.existsSync(completionFilePath)) { fs.unlinkSync(completionFilePath); console.log(`Zsh completion script removed: ${completionFilePath}`); } console.log(` To complete the uninstallation, please manually remove the 'source' lines for fmg from your ~/.zshrc or ~/.bashrc file. `); } catch (err) { console.error("Error removing files:", err); process.exit(1); } };