Skip to content

Commit

Permalink
Issue minishift#1748 Enable single alphanumeric character for profile…
Browse files Browse the repository at this point in the history
… name
  • Loading branch information
praveenkumar authored and LalatenduMohanty committed Nov 30, 2017
1 parent 124ceee commit e993503
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/minishift/cmd/util/util.go
Expand Up @@ -105,8 +105,8 @@ func IsValidProfile(profileName string) bool {
return false
}

// IsValidProfileName return true if profile name follow ^\w+[\w+-]+$
// IsValidProfileName return true if profile name follow ^[a-zA-Z0-9]+[\w+-]*$
func IsValidProfileName(profileName string) bool {
rr := regexp.MustCompile(`^\w+[\w+-]+$`)
rr := regexp.MustCompile(`^[a-zA-Z0-9]+[\w+-]*$`)
return rr.MatchString(profileName)
}
6 changes: 6 additions & 0 deletions cmd/minishift/cmd/util/util_test.go
Expand Up @@ -32,6 +32,12 @@ func TestIsValidProfileName(t *testing.T) {
{"foo_123", true},
{"foo@123", false},
{"", false},
{"a", true},
{"a-", true},
{"a_", true},
{"1", true},
{"_", false},
{"-", false},
{"-foo", false},
{"--hell", false},
{"foo-123", true}}
Expand Down
6 changes: 2 additions & 4 deletions docs/source/using/profiles.adoc
Expand Up @@ -31,10 +31,8 @@ There are two ways to create a new profile.

[NOTE]
====
Profile name can only consist of alphanumeric characters and *-* as a separator, for example:
- foo, bar123, demo-profile and 1stProfile are considered as valid profile names.
- $foo, bar#@, profile@123 are invalid profile names.
Profile name can only consist of alphanumeric characters.
The use of underscore ( *_* ) and hyphen ( *-* ) are allowed as separator.
====

=== Using the `--profile` Flag
Expand Down

0 comments on commit e993503

Please sign in to comment.