mirror of
https://github.com/nushell/nushell
synced 2025-01-13 13:49:21 +00:00
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:
parent
5b398d2ed2
commit
c6da56949c
1 changed files with 3 additions and 3 deletions
|
@ -147,7 +147,7 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> {
|
||||||
for path in search_paths() {
|
for path in search_paths() {
|
||||||
let mut pattern = path.to_path_buf();
|
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) {
|
match glob::glob_with(&pattern.to_string_lossy(), opts) {
|
||||||
Err(_) => {}
|
Err(_) => {}
|
||||||
|
@ -173,14 +173,14 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> {
|
||||||
{
|
{
|
||||||
bin_name
|
bin_name
|
||||||
.chars()
|
.chars()
|
||||||
.all(|c| c.is_ascii_alphabetic() || c == '_' || c == '.')
|
.all(|c| c.is_ascii_alphanumeric() || c == '_' || c == '.')
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
{
|
{
|
||||||
bin_name
|
bin_name
|
||||||
.chars()
|
.chars()
|
||||||
.all(|c| c.is_ascii_alphabetic() || c == '_')
|
.all(|c| c.is_ascii_alphanumeric() || c == '_')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue