Skip to content

Commit

Permalink
Export the touch instance command (openshift#1809)
Browse files Browse the repository at this point in the history
* Export the touch instance command

Move the touch instance command and export it so that
it can be reused to compose a different cli, like the other commands.

* Sync plugin test with new helptext for touch
  • Loading branch information
carolynvs committed Mar 7, 2018
1 parent bddb9a7 commit a7d602b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package touch
package instance

import (
"fmt"
Expand All @@ -29,7 +29,8 @@ type touchInstanceCmd struct {
name string
}

func newTouchInstanceCmd(cxt *command.Context) *cobra.Command {
// NewTouchCommand builds a "svcat touch instance" command.
func NewTouchCommand(cxt *command.Context) *cobra.Command {
touchInstanceCmd := &touchInstanceCmd{Context: cxt}
cmd := &cobra.Command{
Use: "instance",
Expand Down
12 changes: 10 additions & 2 deletions cmd/svcat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
"github.com/kubernetes-incubator/service-catalog/cmd/svcat/instance"
"github.com/kubernetes-incubator/service-catalog/cmd/svcat/plan"
"github.com/kubernetes-incubator/service-catalog/cmd/svcat/plugin"
"github.com/kubernetes-incubator/service-catalog/cmd/svcat/touch"
"github.com/kubernetes-incubator/service-catalog/pkg"
"github.com/kubernetes-incubator/service-catalog/pkg/svcat"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -105,7 +104,7 @@ func buildRootCommand() *cobra.Command {
cmd.AddCommand(binding.NewUnbindCmd(cxt))
cmd.AddCommand(newSyncCmd(cxt))
cmd.AddCommand(newInstallCmd(cxt))
cmd.AddCommand(touch.NewCmd(cxt))
cmd.AddCommand(newTouchCmd(cxt))

return cmd
}
Expand Down Expand Up @@ -162,6 +161,15 @@ func newInstallCmd(cxt *command.Context) *cobra.Command {
return cmd
}

func newTouchCmd(cxt *command.Context) *cobra.Command {
cmd := &cobra.Command{
Use: "touch",
Short: "Force Service Catalog to reprocess a resource",
}
cmd.AddCommand(instance.NewTouchCommand(cxt))
return cmd
}

// Bind the viper configuration back to the cobra command flags.
// Allows us to interact with the cobra flags normally, and while still
// using viper's automatic environment variable binding.
Expand Down
2 changes: 1 addition & 1 deletion cmd/svcat/testdata/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ tree:
shortDesc: Syncs service catalog for a service broker
command: ./svcat sync broker
- name: touch
shortDesc: Make the service catalog attempt to re-provision an instance
shortDesc: Force Service Catalog to reprocess a resource
command: ./svcat touch
tree:
- name: instance
Expand Down
33 changes: 0 additions & 33 deletions cmd/svcat/touch/touch_cmd.go

This file was deleted.

0 comments on commit a7d602b

Please sign in to comment.