Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Cmd = &cobra.Command{ Use: "delete [RESOURCE]", Short: "Delete one resource", ValidArgs: []string{"tasks", "results", "goals"}, Args: cobra.ExactArgs(2), Aliases: []string{"del", "remove"}, Run: func(cmd *cobra.Command, args []string) { resource := args[0] id := args[1] uri := fmt.Sprintf("%v/v1/%v/%v", cfg.API.EndPoint, resource, id) req, err := http.NewRequest(http.MethodDelete, uri, nil) if err != nil { fmt.Println(err) return } client := &http.Client{} resp, err := client.Do(req) if err != nil { fmt.Println(err) return } defer resp.Body.Close() if resp.StatusCode == http.StatusNoContent { fmt.Printf("Delete %v ID: %v is success\n", resource, id) } }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.