MCPcopy Create free account
hub / github.com/arctic-cli/interface / showRemovalSummary

Function showRemovalSummary

packages/arctic/src/cli/cmd/uninstall.ts:103–139  ·  view source on GitHub ↗
(targets: RemovalTargets, method: Installation.Method)

Source from the content-addressed store, hash-verified

101}
102
103async function showRemovalSummary(targets: RemovalTargets, method: Installation.Method) {
104 prompts.log.message("The following will be removed:")
105
106 for (const dir of targets.directories) {
107 const exists = await fs
108 .access(dir.path)
109 .then(() => true)
110 .catch(() => false)
111 if (!exists) continue
112
113 const size = await getDirectorySize(dir.path)
114 const sizeStr = formatSize(size)
115 const status = dir.keep ? UI.Style.TEXT_DIM + "(keeping)" : ""
116 const prefix = dir.keep ? "○" : "✓"
117
118 prompts.log.info(` ${prefix} ${dir.label}: ${shortenPath(dir.path)} ${UI.Style.TEXT_DIM}(${sizeStr})${status}`)
119 }
120
121 if (targets.binary) {
122 prompts.log.info(` ✓ Binary: ${shortenPath(targets.binary)}`)
123 }
124
125 if (targets.shellConfig) {
126 prompts.log.info(` ✓ Shell PATH in ${shortenPath(targets.shellConfig)}`)
127 }
128
129 if (method !== "curl" && method !== "unknown") {
130 const cmds: Record<string, string> = {
131 npm: "npm uninstall -g @arctic-cli/arctic",
132 pnpm: "pnpm uninstall -g @arctic-cli/arctic",
133 bun: "bun remove -g @arctic-cli/arctic",
134 yarn: "yarn global remove @arctic-cli/arctic",
135 brew: "brew uninstall arctic",
136 }
137 prompts.log.info(` ✓ Package: ${cmds[method] || method}`)
138 }
139}
140
141async function executeUninstall(method: Installation.Method, targets: RemovalTargets) {
142 const spinner = prompts.spinner()

Callers 1

uninstall.tsFile · 0.85

Calls 4

getDirectorySizeFunction · 0.85
formatSizeFunction · 0.85
shortenPathFunction · 0.85
messageMethod · 0.45

Tested by

no test coverage detected