Skip to content

Commit

Permalink
Added help messages to all the commands
Browse files Browse the repository at this point in the history
  • Loading branch information
adi6496 committed May 6, 2020
1 parent 420bd01 commit 4d400b8
Show file tree
Hide file tree
Showing 27 changed files with 82 additions and 77 deletions.
5 changes: 3 additions & 2 deletions cmd/ceph-destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.
package cmd

import (
"log"

"github.com/IoTCLI/cmd/utils"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/delete"
"log"
//"time"
)

Expand Down Expand Up @@ -63,7 +64,7 @@ func cephDestroy() {
// destroyCmd represents the destroy command
var cephDestroyCmd = &cobra.Command{
Use: "destroy",
Short: "A brief description of your command",
Short: "Destroy the Ceph cluster",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
5 changes: 3 additions & 2 deletions cmd/ceph-secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.
package cmd

import (
"log"

"github.com/IoTCLI/cmd/utils"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/get"
"log"
)

func getCredentials() {
Expand All @@ -44,7 +45,7 @@ func getCredentials() {
// secretsCmd represents the secrets command
var cephSecretsCmd = &cobra.Command{
Use: "secrets",
Short: "A brief description of your command",
Short: "Get S3 secrets from ceph object storage",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
7 changes: 4 additions & 3 deletions cmd/ceph-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ limitations under the License.
package cmd

import (
"log"
"time"

"github.com/IoTCLI/cmd/utils"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/apply"
"k8s.io/kubectl/pkg/cmd/get"
"log"
"time"
)

//Made from Instructions @https://opendatahub.io/docs/administration/advanced-installation/object-storage.html for installing
Expand Down Expand Up @@ -96,7 +97,7 @@ func cephSetup() {
// setupCmd represents the setup command
var cephSetupCmd = &cobra.Command{
Use: "setup",
Short: "A brief description of your command",
Short: "Setup Ceph Object storage",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
9 changes: 2 additions & 7 deletions cmd/ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,8 @@ import (
// cephCmd represents the ceph command
var cephCmd = &cobra.Command{
Use: "ceph",
Short: "A brief description of your command",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Short: "Deploy Ceph object storage",
Long: `Deploy Ceph object storage`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("ceph called")
},
Expand Down
6 changes: 4 additions & 2 deletions cmd/enmasse-IoT-addDevice.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ import (
//"os"
"bytes"
"crypto/tls"
"github.com/spf13/cobra"
"net/http"
"strings"

"github.com/spf13/cobra"

//in package import
"github.com/IoTCLI/cmd/utils"
"k8s.io/cli-runtime/pkg/genericclioptions"

//"k8s.io/kubectl/pkg/cmd/"
"k8s.io/kubectl/pkg/cmd/get"
)
Expand Down Expand Up @@ -113,7 +115,7 @@ func device(tenant string, deviceID string) {
// addDeviceCmd represents the addDevice command
var addDeviceCmd = &cobra.Command{
Use: "addDevice",
Short: "A brief description of your command",
Short: "Add an IoT device to enmasse",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
6 changes: 2 additions & 4 deletions cmd/enmasse-IoT-project.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import (
"strings"
"time"

"github.com/spf13/cobra"

//in package import
"github.com/IoTCLI/cmd/utils"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/apply"
"k8s.io/kubectl/pkg/cmd/get"
Expand Down Expand Up @@ -118,7 +116,7 @@ func createProject() {
// projectCmd represents the project command
var enmasseIoTProjectCmd = &cobra.Command{
Use: "project",
Short: "A brief description of your command",
Short: "Setup enmasse project",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
2 changes: 1 addition & 1 deletion cmd/enmasse-IoT.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// IoTCmd represents the IoT command
var enmasseIoTCmd = &cobra.Command{
Use: "IoT",
Short: "A brief description of your command",
Short: "Setup Enmasse IoT project",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
2 changes: 1 addition & 1 deletion cmd/enmasse-destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func enmasseDestroy() {
// destroyCmd represents the destroy command
var enmasseDestroyCmd = &cobra.Command{
Use: "destroy",
Short: "A brief description of your command",
Short: "Destroy enmasse project",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
2 changes: 1 addition & 1 deletion cmd/enmasse-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func enmasseSetup() {
// setupCmd represents the setup command
var enmasseSetupCmd = &cobra.Command{
Use: "setup",
Short: "A brief description of your command",
Short: "Setup Enmasse as a messaging backend",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
2 changes: 1 addition & 1 deletion cmd/enmasse.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// enmasseCmd represents the enmasse command
var enmasseCmd = &cobra.Command{
Use: "enmasse",
Short: "A brief description of your command",
Short: "Setup Enmasse as a messaging backend",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
2 changes: 1 addition & 1 deletion cmd/gstreamer-destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func gstreamerDestroy() {
// destroyCmd represents the destroy command
var gstreamerDestroyCmd = &cobra.Command{
Use: "destroy",
Short: "A brief description of your command",
Short: "Destroy gstreamer deployment",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
13 changes: 6 additions & 7 deletions cmd/gstreamer-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,20 @@ import (
// setupCmd represents the setup command
var gstreamerSetupCmd = &cobra.Command{
Use: "setup",
Short: "A brief description of your command",
Short: "Setup Gstreamer with Openvino toolkit for video streaming and analytics",
Long: `A longer descriptSion that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(" gstreamer setup called")
fstatus, _ := cmd.Flags().GetBool("float")
if fstatus { // if status is true, call addFloat
gstreamerSetup()
} else {
log.Println("a")
fmt.Println("Gstreamer setup called")
fstatus, _ := cmd.Flags().GetBool("local")
if fstatus { // if status is true,
gstreamerLocalSetup()
} else {
gstreamerSetup()
}
},
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/gstreamer.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
// gstreamerCmd represents the gstreamer command
var gstreamerCmd = &cobra.Command{
Use: "gstreamer",
Short: "A brief description of your command",
Short: "Setup Gstreamer with OpenVino toolkit for video streaming with analytics ",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
10 changes: 5 additions & 5 deletions cmd/kafka-bridge-destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,21 +95,21 @@ func kafkaBridgeDestroy() {
// destroyCmd represents the destroy command
var kafkaBridgeDestroyCmd = &cobra.Command{
Use: "destroy",
Short: "A brief description of your command",
Short: "Destory the Kafka Bridge",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
fstatus, _ := cmd.Flags().GetBool("float")
if fstatus { // if status is true, call addFloat
fstatus, _ := cmd.Flags().GetBool("route")
if fstatus { // if status is true, call Kafka bridge destroy with route
log.Println("Kafka Bridge Destroy called")
kafkaBridgeDestroy()
kafkaBridgeRouteDestroy()
} else {
log.Println("Kafka Bridge Destroy called")
kafkaBridgeRouteDestroy()
kafkaBridgeDestroy()
}
},
}
Expand Down
10 changes: 5 additions & 5 deletions cmd/kafka-bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func kafkaBridgeRoute() {
// bridgeCmd represents the bridge command
var kafkaBridgeCmd = &cobra.Command{
Use: "bridge",
Short: "A brief description of your command",
Short: "Setup Kafka bridge to send data over to the Kafka cluster",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand All @@ -104,13 +104,13 @@ This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {

fstatus, _ := cmd.Flags().GetBool("float")
fstatus, _ := cmd.Flags().GetBool("route")
if fstatus { // if status is true, call addFloat
log.Println("Kafka Http Bridge called using Ingress")
kafkaBridge()
} else {
log.Println("Kafka Http Bridge called using Route")
kafkaBridgeRoute()
} else {
log.Println("Kafka Http Bridge called using Ingress")
kafkaBridge()
}

},
Expand Down
11 changes: 7 additions & 4 deletions cmd/kafka-destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ limitations under the License.
package cmd

import (
"log"

"github.com/IoTCLI/cmd/utils"
"github.com/spf13/cobra"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/delete"
"log"
)

var (
Expand All @@ -39,8 +40,10 @@ func kafkaDestroy() {
co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/setup/kafka.yaml")
co.Commands = append(co.Commands, "https://github.com/strimzi/strimzi-kafka-operator/releases/download/0.17.0/strimzi-cluster-operator-0.17.0.yaml")
co.Commands = append(co.Commands, "https://raw.githubusercontent.com/redhat-iot/iot-dev/master/yamls/kafka/setup/kafka-namespace.yaml")
co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/mandatory.yaml")
co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/provider/cloud-generic.yaml")

//Destroying kafka
// co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/mandatory.yaml")
// co.Commands = append(co.Commands, "https://raw.githubusercontent.com/kubernetes/ingress-nginx/nginx-0.30.0/deploy/static/provider/cloud-generic.yaml")
//
IOStreams, _, out, _ := genericclioptions.NewTestIOStreams()

Expand All @@ -63,7 +66,7 @@ func kafkaDestroy() {
// destroyCmd represents the destroy command
var kafkaDestroyCmd = &cobra.Command{
Use: "destroy",
Short: "A brief description of your command",
Short: "Destroy the Kafka cluster along with Strimzi operator",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
2 changes: 1 addition & 1 deletion cmd/kafka.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// kafkaCmd represents the kafka command
var kafkaCmd = &cobra.Command{
Use: "kafka",
Short: "A brief description of your command",
Short: "Setup kafka as the messaging backend",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
5 changes: 3 additions & 2 deletions cmd/knative-destroy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
//in package import
"github.com/IoTCLI/cmd/utils"
"k8s.io/cli-runtime/pkg/genericclioptions"

//"k8s.io/kubectl/pkg/cmd/"
"k8s.io/kubectl/pkg/cmd/delete"
)
Expand Down Expand Up @@ -76,15 +77,15 @@ func destroyKnative() {
// destroyCmd represents the destroy command
var knativeDestroyCmd = &cobra.Command{
Use: "destroy",
Short: "A brief description of your command",
Short: "Destroy Knative serving and eventing",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.`,
Run: func(cmd *cobra.Command, args []string) {
log.Println("destroy called")
log.Println("knative destroy called")
destroyKnative()
},
}
Expand Down
11 changes: 6 additions & 5 deletions cmd/knative-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ package cmd

import (
b64 "encoding/base64"
"io/ioutil"
"log"
"os"
"strings"

"github.com/IoTCLI/cmd/utils"
"github.com/spf13/cobra"
"io/ioutil"
"k8s.io/cli-runtime/pkg/genericclioptions"
"k8s.io/kubectl/pkg/cmd/apply"
"k8s.io/kubectl/pkg/cmd/get"
"log"
"os"
"strings"
)

var (
Expand Down Expand Up @@ -197,7 +198,7 @@ func logs(name string) {
// serviceCmd represents the service command
var knativeServiceCmd = &cobra.Command{
Use: "service",
Short: "A brief description of your command",
Short: "Setup Knative service for video analtytics",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
8 changes: 5 additions & 3 deletions cmd/knative-setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,13 @@ import (
//in package import
"github.com/IoTCLI/cmd/utils"
"k8s.io/cli-runtime/pkg/genericclioptions"

//"k8s.io/kubectl/pkg/cmd/"
"k8s.io/kubectl/pkg/cmd/apply"
"k8s.io/kubectl/pkg/cmd/get"
"strings"
"time"

"k8s.io/kubectl/pkg/cmd/apply"
"k8s.io/kubectl/pkg/cmd/get"
)

//var setupStatus = false
Expand Down Expand Up @@ -202,7 +204,7 @@ func knativeStatus() {
// setupCmd represents the setup command
var knativeSetupCmd = &cobra.Command{
Use: "setup",
Short: "A brief description of your command",
Short: "Setup Knative serving and eventing for serverless application",
Long: `A longer description that spans multiple lines and likely contains examples
and usage of using your command. For example:
Expand Down
Loading

0 comments on commit 4d400b8

Please sign in to comment.