MCPcopy Index your code
hub / github.com/prettydiff/prettydiff / removeItems

Function removeItems

services.ts:3762–3808  ·  view source on GitHub ↗
(filelist:directoryList)

Source from the content-addressed store, hash-verified

3760 size: 0
3761 },
3762 removeItems = function node_apps_remove_removeItems(filelist:directoryList):void {
3763 let a:number = 0;
3764 const len:number = filelist.length,
3765 destroy = function node_apps_remove_removeItems_destroy(item:directoryItem) {
3766 const type:"rmdir"|"unlink" = (item[1] === "directory")
3767 ? "rmdir"
3768 : "unlink";
3769 node.fs[type](item[0], function node_apps_remove_removeItems_destroy_callback(er:nodeError):void {
3770 if (verbose === true && er !== null && er.toString().indexOf("no such file or directory") < 0) {
3771 if (er.code === "ENOTEMPTY") {
3772 node_apps_remove_removeItems_destroy(item);
3773 return;
3774 }
3775 apps.errout([er.toString()]);
3776 return;
3777 }
3778 if (item[0] === filelist[0][0]) {
3779 callback();
3780 } else {
3781 filelist[item[2]][3] = filelist[item[2]][3] - 1;
3782 if (filelist[item[2]][3] < 1) {
3783 node_apps_remove_removeItems_destroy(filelist[item[2]]);
3784 }
3785 }
3786 });
3787 };
3788 if (filelist.length < 1) {
3789 callback();
3790 return;
3791 }
3792 do {
3793 if (command === "remove") {
3794 if (filelist[a][1] === "file") {
3795 numb.file = numb.file + 1;
3796 numb.size = numb.size + filelist[a][4].size;
3797 } else if (filelist[a][1] === "directory") {
3798 numb.dirs = numb.dirs + 1;
3799 } else if (filelist[a][1] === "link") {
3800 numb.link = numb.link + 1;
3801 }
3802 }
3803 if ((filelist[a][1] === "directory" && filelist[a][3] === 0) || filelist[a][1] !== "directory") {
3804 destroy(filelist[a]);
3805 }
3806 a = a + 1;
3807 } while (a < len);
3808 };
3809 if (command === "remove") {
3810 if (process.argv.length < 1) {
3811 apps.errout([

Callers

nothing calls this directly

Calls 2

callbackFunction · 0.85
destroyFunction · 0.85

Tested by

no test coverage detected