mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 00:48:59 +02:00
Fix usage parsing for commands defined in CRLF (windows) files (#13212)
Fixes nushell/nushell#13207 # Description This fixes the parsing of command usage when that command comes from a file with CRLF line endings. See nushell/nushell#13207 for more details. # User-Facing Changes Users on Windows will get correct autocompletion for `std` commands.
This commit is contained in:
@ -81,7 +81,9 @@ pub(super) fn build_usage(comment_lines: &[&[u8]]) -> (String, String) {
|
||||
usage.push_str(&comment_line);
|
||||
}
|
||||
|
||||
if let Some((brief_usage, extra_usage)) = usage.split_once("\n\n") {
|
||||
if let Some((brief_usage, extra_usage)) = usage.split_once("\r\n\r\n") {
|
||||
(brief_usage.to_string(), extra_usage.to_string())
|
||||
} else if let Some((brief_usage, extra_usage)) = usage.split_once("\n\n") {
|
||||
(brief_usage.to_string(), extra_usage.to_string())
|
||||
} else {
|
||||
(usage, String::default())
|
||||
|
Reference in New Issue
Block a user