func (m CommandMap) Rename(from, to string) {
	defer m.Unlock()
	m.Lock()
	x, has := m.M[from]
	if !has {
		return
	}
	x.Name = to
	m.M[to] = x
	delete(m.M, from)
}
Rename renames a Command in the Register by adding the
new name with the same *Command and deleting the old one. This is
useful when a name conflict causes New to append and underscore (_)
to the duplicate's name. Rename can be called from init() at any
point after the duplicate has been added to resolve the conflict.
Note the order of init() execution --- while predictable --- is not
always apparent.  When in doubt do Rename from main() to be sure.
Rename is safe for concurrency.
package cmdbox
import (
	"fmt"
	"sort"
	"sync"
	"github.com/rwxrob/cmdbox/util"
)
type CommandMap struct {
	M map[string]*Command
	sync.Mutex
}
func NewCommandMap() *CommandMap {
	m := new(CommandMap)
	m.Init()
	return m
}
func (m *CommandMap) Init() {
	defer m.Unlock()
	m.Lock()
	if m.M == nil {
		m.M = make(map[string]*Command)
		return
	}
	for k := range m.M {
		delete(m.M, k)
	}
}
func (m *CommandMap) Get(key string) *Command {
	defer m.Unlock()
	m.Lock()
	if v, has := m.M[key]; has {
		return v
	}
	return nil
}
func (m *CommandMap) Set(key string, val *Command) {
	defer m.Unlock()
	m.Lock()
	m.M[key] = val
}
func (m *CommandMap) Delete(keys ...string) {
	defer m.Unlock()
	m.Lock()
	for _, k := range keys {
		delete(m.M, k)
	}
}