this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Delete labeler declaration in `label delete` command if no labels remain

futurGH 2f63bafa ed5b7ca7

+15 -5
+15 -5
src/bin.ts
··· 102 102 ); 103 103 } 104 104 } else { 105 + if (!labelDefinitions.length) { 106 + console.log( 107 + "No labels are currently declared. Use the `label add` command to define new labels.", 108 + ); 109 + process.exit(0); 110 + } 111 + 105 112 const { identifiers } = await prompt({ 106 113 type: "multiselect", 107 114 name: "identifiers", ··· 113 120 })), 114 121 }, { onCancel: () => process.exit(1) }); 115 122 116 - await setLabelerLabelDefinitions( 117 - { identifier: did, password, pds }, 118 - labelDefinitions.filter((def) => !identifiers.includes(def.identifier)), 119 - ); 123 + const definitions = labelDefinitions.filter((def) => !identifiers.includes(def.identifier)); 120 124 121 - console.log("Deleted label(s):", identifiers.join(", ")); 125 + if (definitions.length) { 126 + await setLabelerLabelDefinitions({ identifier: did, password, pds }, definitions); 127 + console.log("Deleted label(s):", identifiers.join(", ")); 128 + } else { 129 + await deleteLabelerDeclaration({ identifier: did, password, pds }); 130 + console.log("All labels cleared."); 131 + } 122 132 } 123 133 } else { 124 134 console.log("Usage: npx @skyware/labeler [command]");