Skip to content

Commit

Permalink
operations.go: Add operations command
Browse files Browse the repository at this point in the history
  • Loading branch information
palash25 committed May 27, 2018
1 parent 676f449 commit 98fe61b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
16 changes: 16 additions & 0 deletions cmd/operations.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package cmd

import (
"fmt"
"github.com/palash25/foaas-cli/fuck"
"github.com/spf13/cobra"
)

var operationsCmd = &cobra.Command{
Use: "operations",
Short: "Print the operations of FOaaS",
Run: func(cmd *cobra.Command, args []string) {
ops := fuck.GetOperations()
fmt.Println(ops)
},
}
3 changes: 2 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var rootCmd = &cobra.Command{
(Fuck Off as a Service) API built with love by palash25
in an effort to learn Go`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("fasfaf")
fmt.Println("Root executed")
},
}

Expand All @@ -26,4 +26,5 @@ func Execute() {

func init() {
rootCmd.AddCommand(versionCmd)
rootCmd.AddCommand(operationsCmd)
}
5 changes: 2 additions & 3 deletions fuck/fuck.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package fuck

import (
"fmt"
"net/http"
"log"
"io/ioutil"
Expand Down Expand Up @@ -41,8 +40,8 @@ func GetVersion() string {
return makeRequest("version")
}

func GetOperations() {
fmt.Println(makeRequest("operations"))
func GetOperations() string {
return makeRequest("operations")
}

func Anyway(comapany, from string) string {
Expand Down

0 comments on commit 98fe61b

Please sign in to comment.