-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/davecgh/go-spew/spew" | ||
"github.com/spf13/cobra" | ||
"k8s.io/cli-runtime/pkg/genericclioptions" | ||
// "k8s.io/kubernetes/pkg/kubectl/util/templates" | ||
) | ||
|
||
var ( | ||
deleteShort = `Delete a bpftrace program execution` // Wrap with i18n.T() | ||
deleteLong = ` | ||
...` | ||
|
||
deleteExamples = ` | ||
# Delete a specific bpftrace program | ||
%[1]s trace delete k656ee75a-ee3c-11e8-9e7a-8c164500a77e | ||
# Delete all bpftrace programs in a specific namespace | ||
%[1]s trace delete -n myns"` | ||
) | ||
|
||
// DeleteOptions ... | ||
type DeleteOptions struct { | ||
genericclioptions.IOStreams | ||
} | ||
|
||
// NewDeleteOptions provides an instance of DeleteOptions with default values. | ||
func NewDeleteOptions(streams genericclioptions.IOStreams) *DeleteOptions { | ||
return &DeleteOptions{ | ||
IOStreams: streams, | ||
} | ||
} | ||
|
||
// NewDeleteCommand provides the delete command wrapping DeleteOptions. | ||
func NewDeleteCommand(streams genericclioptions.IOStreams) *cobra.Command { | ||
o := NewDeleteOptions(streams) | ||
|
||
cmd := &cobra.Command{ | ||
Use: "delete TRACE_ID", | ||
Short: deleteShort, | ||
Long: deleteLong, // Wrap with templates.LongDesc() | ||
Example: fmt.Sprintf(deleteExamples, "kubectl"), // Wrap with templates.Examples() | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("delete") | ||
spew.Dump(o) | ||
}, | ||
} | ||
|
||
return cmd | ||
} |