configcommands/rename_space.go
func (c *RenameSpaceConfigurationCommand) Execute(args []string) error {
	c.initConfig()
	spaceConfig, err := c.ConfigManager.GetSpaceConfig(c.OrgName, c.SpaceName)
	if err != nil {
		return err
	}

	spaces, err := c.ConfigManager.OrgSpaces(c.OrgName)
	if err != nil {
		return err
	}
	spaceConfig.Space = c.NewSpaceName
	spaceConfig.OriginalSpace = c.SpaceName

	err = c.ConfigManager.RenameSpaceConfig(spaceConfig)
	if err != nil {
		return err
	}
	spaces.Replace(c.SpaceName, c.NewSpaceName)
	err = c.ConfigManager.SaveOrgSpaces(spaces)
	if err != nil {
		return err
	}
	fmt.Println(fmt.Sprintf("The org/space [%s/%s] has been renamed to [%s/%s]", c.OrgName, c.SpaceName, c.OrgName, c.NewSpaceName))
	return nil
}
func (c *RenameSpaceConfigurationCommand) Execute(args []string) error {
	c.initConfig()
	spaceConfig, err := c.ConfigManager.GetSpaceConfig(c.OrgName, c.SpaceName)
	if err != nil {
		return err
	}

	spaces, err := c.ConfigManager.OrgSpaces(c.OrgName)
	if err != nil {
		return err
	}
	spaceConfig.Space = c.NewSpaceName
	spaceConfig.OriginalSpace = c.SpaceName

	err = c.ConfigManager.RenameSpaceConfig(spaceConfig)
	if err != nil {
		return err
	}
	spaces.Replace(c.SpaceName, c.NewSpaceName)
	err = c.ConfigManager.SaveOrgSpaces(spaces)
	if err != nil {
		return err
	}
	fmt.Println(fmt.Sprintf("The org/space [%s/%s] has been renamed to [%s/%s]", c.OrgName, c.SpaceName, c.OrgName, c.NewSpaceName))
	return nil
}
func ( c * RenameSpaceConfigurationCommand ) Execute ( args [ ] string ) error { c . initConfig ( ) spaceConfig , err := c . ConfigManager . GetSpaceConfig ( c . OrgName , c . SpaceName ) if err != nil { return err } spaces , err := c . ConfigManager . OrgSpaces ( c . OrgName ) if err != nil { return err } spaceConfig . Space = c . NewSpaceName spaceConfig . OriginalSpace = c . SpaceName err = c . ConfigManager . RenameSpaceConfig ( spaceConfig ) if err != nil { return err } spaces . Replace ( c . SpaceName , c . NewSpaceName ) err = c . ConfigManager . SaveOrgSpaces ( spaces ) if err != nil { return err } fmt . Println ( fmt . Sprintf ( " " , c . OrgName , c . SpaceName , c . OrgName , c . NewSpaceName ) ) return nil }
//Execute - renames space config
Execute - renames space config