Add support for plugin names containing numbers (#1321)

* Add ability to have numbers in plugin name. Plugin must start with alphabetic char

* remove the first character as alphabetic requirement

* Update cli.rs

Going ahead and changing to plus to prevent issue notryanb found

* Update cli.rs

Co-authored-by: Jonathan Turner <jonathandturner@users.noreply.github.com>
This commit is contained in:
Ryan Blecher 2020-02-02 01:08:38 -05:00 committed by GitHub
parent 5b398d2ed2
commit c6da56949c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -147,7 +147,7 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> {
for path in search_paths() {
let mut pattern = path.to_path_buf();
pattern.push(std::path::Path::new("nu_plugin_[a-z]*"));
pattern.push(std::path::Path::new("nu_plugin_[a-z0-9][a-z0-9]*"));
match glob::glob_with(&pattern.to_string_lossy(), opts) {
Err(_) => {}
@ -173,14 +173,14 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> {
{
bin_name
.chars()
.all(|c| c.is_ascii_alphabetic() || c == '_' || c == '.')
.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '.')
}
#[cfg(not(windows))]
{
bin_name
.chars()
.all(|c| c.is_ascii_alphabetic() || c == '_')
.all(|c| c.is_ascii_alphanumeric() || c == '_')
}
};