nu-command/filters: drop column check positive value (#6412)

This commit is contained in:
Herlon Aguiar
2022-08-25 18:03:18 +02:00
committed by GitHub
parent 7b502a4c7f
commit 918ec9daa8
2 changed files with 18 additions and 0 deletions

View File

@ -49,6 +49,13 @@ impl Command for DropColumn {
1
};
// Make columns to drop is positive
if columns_to_drop < 0 {
if let Some(expr) = call.positional_nth(0) {
return Err(ShellError::NeedsPositiveValue(expr.span));
}
}
dropcol(engine_state, span, input, columns_to_drop)
}