@mathiscode/pucc 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -367,6 +367,41 @@ shell.addCommand('greet', (args) => {
|
|
|
367
367
|
|
|
368
368
|
**Note:** In IIFE builds, you can also use `Pucc.addCommand()` which adds to the global instance automatically created.
|
|
369
369
|
|
|
370
|
+
### `shell.removeCommand(name)`
|
|
371
|
+
|
|
372
|
+
Remove a command from a Pucc instance. The command is immediately removed from terminals and (if `enableGlobalRegistrations` is true) from the console.
|
|
373
|
+
|
|
374
|
+
**Parameters:**
|
|
375
|
+
|
|
376
|
+
- `name` (string): Command name (without prefix)
|
|
377
|
+
|
|
378
|
+
**Returns:**
|
|
379
|
+
|
|
380
|
+
- `boolean`: `true` if the command was successfully removed, `false` if the command was not found
|
|
381
|
+
|
|
382
|
+
**Example:**
|
|
383
|
+
|
|
384
|
+
```javascript
|
|
385
|
+
const shell = new Pucc();
|
|
386
|
+
|
|
387
|
+
// Add a command
|
|
388
|
+
shell.addCommand('greet', (args) => {
|
|
389
|
+
console.log(`Hello, ${args._[0] || 'World'}!`);
|
|
390
|
+
}, 'Greet someone');
|
|
391
|
+
|
|
392
|
+
// Remove the command
|
|
393
|
+
const removed = shell.removeCommand('greet');
|
|
394
|
+
if (removed) {
|
|
395
|
+
console.log('Command removed successfully');
|
|
396
|
+
} else {
|
|
397
|
+
console.log('Command not found');
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// The command is no longer available in console or terminals
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
**Note:** In IIFE builds, you can also use `Pucc.removeCommand()` which removes from the global instance automatically created.
|
|
404
|
+
|
|
370
405
|
### `ParsedArgs`
|
|
371
406
|
|
|
372
407
|
The argument object passed to command handlers:
|