mirror of
https://github.com/docker/cli.git
synced 2025-04-18 19:24:03 +03:00
cli-plugins/manager: use lazyregexp to compile regexes on first use
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
7fde1f799f
commit
1ed3859879
@ -8,14 +8,14 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/docker/cli/cli-plugins/metadata"
|
||||
"github.com/docker/cli/internal/lazyregexp"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var pluginNameRe = regexp.MustCompile("^[a-z][a-z0-9]*$")
|
||||
var pluginNameRe = lazyregexp.New("^[a-z][a-z0-9]*$")
|
||||
|
||||
// Plugin represents a potential plugin with all it's metadata.
|
||||
type Plugin struct {
|
||||
|
@ -75,6 +75,10 @@ func (r *Regexp) ReplaceAllLiteralString(src, repl string) string {
|
||||
return r.re().ReplaceAllLiteralString(src, repl)
|
||||
}
|
||||
|
||||
func (r *Regexp) String() string {
|
||||
return r.re().String()
|
||||
}
|
||||
|
||||
func (r *Regexp) SubexpNames() []string {
|
||||
return r.re().SubexpNames()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user