-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from conduktor/add_various_command
Add various command
- Loading branch information
Showing
14 changed files
with
565 additions
and
44 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
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
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
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,28 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/conduktor/ctl/client" | ||
"github.com/spf13/cobra" | ||
"os" | ||
) | ||
|
||
// applyCmd represents the apply command | ||
var deleteCmd = &cobra.Command{ | ||
Use: "delete", | ||
Short: "delete resource of a given kind and name", | ||
Long: ``, | ||
Args: cobra.ExactArgs(2), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
client := client.MakeFromEnv(*debug) | ||
err := client.Delete(args[0], args[1]) | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "%s\n", err) | ||
os.Exit(1) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(deleteCmd) | ||
} |
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,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"github.com/conduktor/ctl/client" | ||
"github.com/spf13/cobra" | ||
"os" | ||
) | ||
|
||
// applyCmd represents the apply command | ||
var getCmd = &cobra.Command{ | ||
Use: "get kind [name]", | ||
Short: "get resource of a given kind", | ||
Long: ``, | ||
Args: cobra.MatchAll(cobra.MinimumNArgs(1), cobra.MaximumNArgs(2)), | ||
Run: func(cmd *cobra.Command, args []string) { | ||
client := client.MakeFromEnv(*debug) | ||
var err error | ||
if len(args) == 1 { | ||
err = client.Get(args[0]) | ||
} else if len(args) == 2 { | ||
err = client.Describe(args[0], args[1]) | ||
} | ||
if err != nil { | ||
fmt.Fprintf(os.Stderr, "%s\n", err) | ||
os.Exit(1) | ||
} | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(getCmd) | ||
} |
Oops, something went wrong.