Commit 71ef96a
committed
Support usage as plugin for tools like kubectl
In this case the executable is `kubectl-plugin`, but we run it as:
kubectl plugin
And the help text should reflect the actual usage of the command.
To create a plugin create the root command like:
rootCmd := &cobra.Command{
CommandName: "kubectl plugin",
}
When `CommandName` is set, Name() use it as is instead of guessing the
command name from the `Use` line.
Issues:
- Need to update the docs.
Fixes: #2017
Signed-off-by: Nir Soffer <[email protected]>1 parent fd865a4 commit 71ef96a
2 files changed
+31
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
62 | 66 | | |
| |||
1441 | 1445 | | |
1442 | 1446 | | |
1443 | 1447 | | |
1444 | | - | |
| 1448 | + | |
1445 | 1449 | | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
1446 | 1453 | | |
1447 | 1454 | | |
1448 | 1455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
369 | 392 | | |
370 | 393 | | |
371 | 394 | | |
| |||
0 commit comments