MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / removePackage

Method removePackage

src/helpViewer/packages.ts:194–207  ·  view source on GitHub ↗
(pkgName: string)

Source from the content-addressed store, hash-verified

192
193 // remove a specified package. The packagename is selected e.g. in the help tree-view
194 public async removePackage(pkgName: string): Promise<boolean> {
195 const rPath = this.rHelp.rPath;
196 const args = ['--silent', '--no-echo', '--no-save', '--no-restore', '-e', `remove.packages('${pkgName}')`];
197 const cmd = `${rPath} ${args.join(' ')}`;
198 const confirmation = 'Yes, remove package!';
199 const prompt = `Are you sure you want to remove package ${pkgName}?`;
200
201 if(await getConfirmation(prompt, confirmation, cmd)){
202 await executeAsTask('Remove Package', rPath, args, true);
203 return true;
204 } else{
205 return false;
206 }
207 }
208
209 // actually install packages
210 // confirmation can be skipped (e.g. if the user has confimred before)

Callers 1

_handleCommandMethod · 0.80

Calls 2

getConfirmationFunction · 0.90
executeAsTaskFunction · 0.90

Tested by

no test coverage detected