mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
compatible with old rust (#5974)
This commit is contained in:
parent
8abf28093a
commit
e0b4ab09eb
6 changed files with 30 additions and 6 deletions
|
@ -63,7 +63,11 @@ impl Command for BytesAdd {
|
|||
) -> Result<PipelineData, ShellError> {
|
||||
let added_data: Vec<u8> = call.req(engine_state, stack, 0)?;
|
||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 1)?;
|
||||
let column_paths = (!column_paths.is_empty()).then_some(column_paths);
|
||||
let column_paths = if column_paths.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(column_paths)
|
||||
};
|
||||
let index: Option<usize> = call.get_flag(engine_state, stack, "index")?;
|
||||
let end = call.has_flag("end");
|
||||
|
||||
|
|
|
@ -54,7 +54,11 @@ impl Command for BytesEndsWith {
|
|||
) -> Result<PipelineData, ShellError> {
|
||||
let pattern: Vec<u8> = call.req(engine_state, stack, 0)?;
|
||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 1)?;
|
||||
let column_paths = (!column_paths.is_empty()).then_some(column_paths);
|
||||
let column_paths = if column_paths.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(column_paths)
|
||||
};
|
||||
let arg = Arguments {
|
||||
pattern,
|
||||
column_paths,
|
||||
|
|
|
@ -50,7 +50,11 @@ impl Command for BytesLen {
|
|||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 1)?;
|
||||
let column_paths = (!column_paths.is_empty()).then_some(column_paths);
|
||||
let column_paths = if column_paths.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(column_paths)
|
||||
};
|
||||
let arg = Arguments { column_paths };
|
||||
operate(length, arg, input, call.head, engine_state.ctrlc.clone())
|
||||
}
|
||||
|
|
|
@ -56,7 +56,11 @@ impl Command for BytesReplace {
|
|||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 2)?;
|
||||
let column_paths = (!column_paths.is_empty()).then_some(column_paths);
|
||||
let column_paths = if column_paths.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(column_paths)
|
||||
};
|
||||
let find = call.req::<Vec<u8>>(engine_state, stack, 0)?;
|
||||
if find.is_empty() {
|
||||
return Err(ShellError::UnsupportedInput(
|
||||
|
|
|
@ -51,7 +51,11 @@ impl Command for BytesReverse {
|
|||
input: PipelineData,
|
||||
) -> Result<PipelineData, ShellError> {
|
||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 0)?;
|
||||
let column_paths = (!column_paths.is_empty()).then_some(column_paths);
|
||||
let column_paths = if column_paths.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(column_paths)
|
||||
};
|
||||
let arg = Arguments { column_paths };
|
||||
operate(reverse, arg, input, call.head, engine_state.ctrlc.clone())
|
||||
}
|
||||
|
|
|
@ -54,7 +54,11 @@ impl Command for BytesStartsWith {
|
|||
) -> Result<PipelineData, ShellError> {
|
||||
let pattern: Vec<u8> = call.req(engine_state, stack, 0)?;
|
||||
let column_paths: Vec<CellPath> = call.rest(engine_state, stack, 1)?;
|
||||
let column_paths = (!column_paths.is_empty()).then_some(column_paths);
|
||||
let column_paths = if column_paths.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(column_paths)
|
||||
};
|
||||
let arg = Arguments {
|
||||
pattern,
|
||||
column_paths,
|
||||
|
|
Loading…
Reference in a new issue