mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:25:43 +02:00
Add command_prelude
module (#12291)
# Description When implementing a `Command`, one must also import all the types present in the function signatures for `Command`. This makes it so that we often import the same set of types in each command implementation file. E.g., something like this: ```rust use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ record, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type, Value, }; ``` This PR adds the `nu_engine::command_prelude` module which contains the necessary and commonly used types to implement a `Command`: ```rust // command_prelude.rs pub use crate::CallExt; pub use nu_protocol::{ ast::{Call, CellPath}, engine::{Command, EngineState, Stack}, record, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, IntoSpanned, PipelineData, Record, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value, }; ``` This should reduce the boilerplate needed to implement a command and also gives us a place to track the breadth of the `Command` API. I tried to be conservative with what went into the prelude modules, since it might be hard/annoying to remove items from the prelude in the future. Let me know if something should be included or excluded.
This commit is contained in:
@ -1,10 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::ast::CellPath;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::Category;
|
||||
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
added_data: Vec<u8>,
|
||||
|
@ -1,12 +1,9 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_cmd_base::util;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::record;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, Range, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
use nu_cmd_base::{
|
||||
input_handler::{operate, CmdArgument},
|
||||
util,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::Range;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BytesAt;
|
||||
|
@ -1,11 +1,4 @@
|
||||
use nu_engine::get_eval_expression;
|
||||
use nu_protocol::ast::Call;
|
||||
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_eval_expression};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BytesBuild;
|
||||
|
@ -1,9 +1,4 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_full_help};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Bytes;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct BytesCollect;
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::ast::CellPath;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::Category;
|
||||
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
pattern: Vec<u8>,
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, CellPath};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
pattern: Vec<u8>,
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::ast::CellPath;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::Category;
|
||||
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct BytesLen;
|
||||
|
@ -1,11 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
pattern: Vec<u8>,
|
||||
|
@ -1,11 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
find: Vec<u8>,
|
||||
|
@ -1,13 +1,7 @@
|
||||
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::ast::CellPath;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::Category;
|
||||
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
pub struct BytesReverse;
|
||||
|
||||
impl Command for BytesReverse {
|
||||
|
@ -1,11 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::ast::CellPath;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::Category;
|
||||
use nu_protocol::IntoPipelineData;
|
||||
use nu_protocol::{Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
pattern: Vec<u8>,
|
||||
|
@ -1,12 +1,7 @@
|
||||
use super::hashable_value::HashableValue;
|
||||
use itertools::Itertools;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use std::collections::HashMap;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,10 +1,6 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use print_positions::print_positions;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,11 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
pub struct Arguments {
|
||||
cell_paths: Option<Vec<CellPath>>,
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
@ -1,9 +1,5 @@
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath, PathMember},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, Record, ShellError, Signature, Span, Type,
|
||||
Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::ast::{CellPath, PathMember};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct IntoCellPath;
|
||||
|
@ -1,9 +1,4 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_full_help};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Into;
|
||||
|
@ -1,15 +1,8 @@
|
||||
use crate::{generate_strftime_list, parse_date_from_string};
|
||||
use chrono::NaiveTime;
|
||||
use chrono::{DateTime, FixedOffset, Local, TimeZone, Utc};
|
||||
use chrono::{DateTime, FixedOffset, Local, NaiveTime, TimeZone, Utc};
|
||||
use human_date_parser::{from_human_time, ParseResult};
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
zone_options: Option<Spanned<Zone>>,
|
||||
|
@ -1,10 +1,8 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_parser::{parse_unit_value, DURATION_UNIT_GROUPS};
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath, Expr},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Unit,
|
||||
Value,
|
||||
ast::{CellPath, Expr},
|
||||
Unit,
|
||||
};
|
||||
|
||||
const NS_PER_SEC: i64 = 1_000_000_000;
|
||||
|
@ -1,10 +1,6 @@
|
||||
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use nu_utils::get_system_locale;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CellPathOnlyArgs};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
@ -1,11 +1,5 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
struct Arguments {
|
||||
cell_paths: Option<Vec<CellPath>>,
|
||||
|
@ -1,11 +1,7 @@
|
||||
use chrono::{FixedOffset, TimeZone};
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use nu_utils::get_system_locale;
|
||||
|
||||
struct Arguments {
|
||||
|
@ -1,10 +1,6 @@
|
||||
use chrono::{DateTime, Datelike, FixedOffset, Timelike};
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
format_duration_as_timeperiod, record, Category, Example, IntoPipelineData, PipelineData,
|
||||
Record, ShellError, Signature, Span, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::format_duration_as_timeperiod;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
@ -1,11 +1,6 @@
|
||||
use nu_cmd_base::input_handler::{operate, CmdArgument};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::{Call, CellPath},
|
||||
engine::{Command, EngineState, Stack},
|
||||
into_code, Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature,
|
||||
Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::{into_code, Config};
|
||||
use nu_utils::get_system_locale;
|
||||
use num_format::ToFormattedString;
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
use crate::parse_date_from_string;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, PipelineIterator, ShellError,
|
||||
Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::PipelineIterator;
|
||||
use once_cell::sync::Lazy;
|
||||
use regex::{Regex, RegexBuilder};
|
||||
use std::collections::HashSet;
|
||||
|
@ -1,15 +1,13 @@
|
||||
use crate::database::values::sqlite::{open_sqlite_db, values_to_sql};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, Record, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
use std::{
|
||||
path::Path,
|
||||
sync::{
|
||||
atomic::{AtomicBool, Ordering},
|
||||
Arc,
|
||||
},
|
||||
};
|
||||
use std::path::Path;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
pub const DEFAULT_TABLE_NAME: &str = "main";
|
||||
|
||||
|
@ -1,14 +1,5 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
use crate::database::values::sqlite::nu_value_to_params;
|
||||
|
||||
use super::super::SQLiteDatabase;
|
||||
use crate::database::{values::sqlite::nu_value_to_params, SQLiteDatabase};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct QueryDb;
|
||||
|
@ -1,11 +1,8 @@
|
||||
use super::super::SQLiteDatabase;
|
||||
use crate::database::values::definitions::{db_row::DbRow, db_table::DbTable};
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Example, PipelineData, Record, ShellError, Signature, Span, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use rusqlite::Connection;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SchemaDb;
|
||||
|
||||
|
@ -1,9 +1,4 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_full_help};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Date;
|
||||
|
@ -1,9 +1,8 @@
|
||||
use crate::date::utils::parse_date_from_string;
|
||||
use chrono::{DateTime, FixedOffset, Local};
|
||||
use chrono_humanize::HumanTime;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
||||
|
@ -1,10 +1,5 @@
|
||||
use chrono_tz::TZ_VARIANTS;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
@ -1,9 +1,6 @@
|
||||
use chrono::Local;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
||||
|
@ -1,11 +1,6 @@
|
||||
use crate::date::utils::parse_date_from_string;
|
||||
use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, PipelineData, ShellError, ShellError::DatetimeParseError,
|
||||
ShellError::PipelineEmpty, Signature, Span, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
@ -43,7 +38,7 @@ impl Command for SubCommand {
|
||||
let head = call.head;
|
||||
// This doesn't match explicit nulls
|
||||
if matches!(input, PipelineData::Empty) {
|
||||
return Err(PipelineEmpty { dst_span: head });
|
||||
return Err(ShellError::PipelineEmpty { dst_span: head });
|
||||
}
|
||||
input.map(move |value| helper(value, head), engine_state.ctrlc.clone())
|
||||
}
|
||||
@ -117,7 +112,7 @@ fn helper(val: Value, head: Span) -> Value {
|
||||
}
|
||||
Value::Date { val, .. } => parse_date_into_table(val, head),
|
||||
_ => Value::error(
|
||||
DatetimeParseError {
|
||||
ShellError::DatetimeParseError {
|
||||
msg: val.to_debug_string(),
|
||||
span: head,
|
||||
},
|
||||
|
@ -1,11 +1,6 @@
|
||||
use crate::date::utils::parse_date_from_string;
|
||||
use chrono::{DateTime, Datelike, FixedOffset, Local, Timelike};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, PipelineData, ShellError, ShellError::DatetimeParseError,
|
||||
ShellError::PipelineEmpty, Signature, Span, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
@ -43,7 +38,7 @@ impl Command for SubCommand {
|
||||
let head = call.head;
|
||||
// This doesn't match explicit nulls
|
||||
if matches!(input, PipelineData::Empty) {
|
||||
return Err(PipelineEmpty { dst_span: head });
|
||||
return Err(ShellError::PipelineEmpty { dst_span: head });
|
||||
}
|
||||
input.map(move |value| helper(value, head), engine_state.ctrlc.clone())
|
||||
}
|
||||
@ -116,7 +111,7 @@ fn helper(val: Value, head: Span) -> Value {
|
||||
}
|
||||
Value::Date { val, .. } => parse_date_into_table(val, head),
|
||||
_ => Value::error(
|
||||
DatetimeParseError {
|
||||
ShellError::DatetimeParseError {
|
||||
msg: val.to_debug_string(),
|
||||
span: head,
|
||||
},
|
||||
|
@ -1,14 +1,7 @@
|
||||
use super::parser::datetime_in_timezone;
|
||||
use crate::date::utils::parse_date_from_string;
|
||||
use chrono::{DateTime, Local, LocalResult};
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
use chrono::{FixedOffset, TimeZone};
|
||||
use chrono::{DateTime, FixedOffset, Local, LocalResult, TimeZone};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct SubCommand;
|
||||
|
@ -1,11 +1,6 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_parser::parse;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack, StateWorkingSet},
|
||||
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_protocol::engine::StateWorkingSet;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Ast;
|
||||
|
@ -1,7 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Span, Type, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Debug;
|
||||
|
@ -1,10 +1,7 @@
|
||||
use nu_engine::{get_eval_expression, CallExt};
|
||||
use nu_protocol::ast::{Argument, Block, Call, Expr, Expression};
|
||||
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack};
|
||||
use nu_engine::{command_prelude::*, get_eval_expression};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature,
|
||||
Span, SyntaxShape, Type, Value,
|
||||
ast::{Argument, Block, Expr, Expression},
|
||||
engine::Closure,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,10 +1,7 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoPipelineData, LazyRecord, PipelineData, Record, ShellError,
|
||||
Signature, Span, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::LazyRecord;
|
||||
use sysinfo::{MemoryRefreshKind, Pid, ProcessRefreshKind, RefreshKind, System};
|
||||
|
||||
const ENV_PATH_SEPARATOR_CHAR: char = {
|
||||
#[cfg(target_family = "windows")]
|
||||
{
|
||||
|
@ -1,9 +1,5 @@
|
||||
use super::inspect_table;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use terminal_size::{terminal_size, Height, Width};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,3 +1,6 @@
|
||||
use crate::debug::inspect_table::{
|
||||
global_horizontal_char::SetHorizontalChar, set_widths::SetWidths,
|
||||
};
|
||||
use nu_protocol::Value;
|
||||
use nu_table::{string_width, string_wrap};
|
||||
use tabled::{
|
||||
@ -6,10 +9,6 @@ use tabled::{
|
||||
Table,
|
||||
};
|
||||
|
||||
use crate::debug::inspect_table::{
|
||||
global_horizontal_char::SetHorizontalChar, set_widths::SetWidths,
|
||||
};
|
||||
|
||||
pub fn build_table(value: Value, description: String, termsize: usize) -> String {
|
||||
let (head, mut data) = util::collect_input(value);
|
||||
let count_columns = head.len();
|
||||
|
@ -1,9 +1,7 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, Expr, Expression};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::{
|
||||
record, Category, DataSource, Example, IntoPipelineData, PipelineData, PipelineMetadata,
|
||||
Record, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
ast::{Expr, Expression},
|
||||
DataSource, PipelineMetadata,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,9 +1,7 @@
|
||||
use nu_engine::{eval_block_with_early_return, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::debugger::{Profiler, WithDebug};
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack};
|
||||
use nu_engine::{command_prelude::*, eval_block_with_early_return};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type,
|
||||
debugger::{Profiler, WithDebug},
|
||||
engine::Closure,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,11 +1,4 @@
|
||||
use nu_engine::{get_eval_block, get_eval_expression_with_input};
|
||||
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type,
|
||||
Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_eval_block, get_eval_expression_with_input};
|
||||
use std::time::Instant;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,9 +1,4 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_full_help};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct View;
|
||||
|
@ -1,8 +1,4 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ViewFiles;
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type,
|
||||
Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use std::fmt::Write;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned,
|
||||
SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ViewSpan;
|
||||
|
@ -1,9 +1,9 @@
|
||||
use nu_protocol::engine::{EngineState, StateWorkingSet};
|
||||
|
||||
use crate::{
|
||||
help::{HelpAliases, HelpCommands, HelpEscapes, HelpExterns, HelpModules, HelpOperators},
|
||||
*,
|
||||
};
|
||||
use nu_protocol::engine::{EngineState, StateWorkingSet};
|
||||
|
||||
pub fn add_shell_command_context(mut engine_state: EngineState) -> EngineState {
|
||||
let delta = {
|
||||
let mut working_set = StateWorkingSet::new(&engine_state);
|
||||
|
7
crates/nu-command/src/env/config/config_.rs
vendored
7
crates/nu-command/src/env/config/config_.rs
vendored
@ -1,9 +1,4 @@
|
||||
use nu_engine::get_full_help;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_full_help};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ConfigMeta;
|
||||
|
@ -1,12 +1,6 @@
|
||||
use nu_engine::{env_to_strings, CallExt};
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
|
||||
use super::utils::gen_command;
|
||||
use nu_cmd_base::util::get_editor;
|
||||
use nu_engine::{command_prelude::*, env_to_strings};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ConfigEnv;
|
||||
|
@ -1,12 +1,6 @@
|
||||
use nu_engine::{env_to_strings, CallExt};
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
|
||||
use super::utils::gen_command;
|
||||
use nu_cmd_base::util::get_editor;
|
||||
use nu_engine::{command_prelude::*, env_to_strings};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ConfigNu;
|
||||
|
@ -1,10 +1,6 @@
|
||||
use chrono::Local;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Type,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use nu_utils::{get_default_config, get_default_env};
|
||||
use std::io::Write;
|
||||
|
||||
|
7
crates/nu-command/src/env/config/utils.rs
vendored
7
crates/nu-command/src/env/config/utils.rs
vendored
@ -1,9 +1,6 @@
|
||||
use std::collections::HashMap;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use nu_protocol::{IoStream, Span, Spanned};
|
||||
|
||||
use crate::ExternalCommand;
|
||||
use nu_protocol::{IoStream, Span, Spanned};
|
||||
use std::{collections::HashMap, path::PathBuf};
|
||||
|
||||
pub(crate) fn gen_command(
|
||||
span: Span,
|
||||
|
9
crates/nu-command/src/env/export_env.rs
vendored
9
crates/nu-command/src/env/export_env.rs
vendored
@ -1,10 +1,5 @@
|
||||
use nu_engine::{get_eval_block, redirect_env, CallExt};
|
||||
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Closure, Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_eval_block, redirect_env};
|
||||
use nu_protocol::engine::Closure;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct ExportEnv;
|
||||
|
7
crates/nu-command/src/env/load_env.rs
vendored
7
crates/nu-command/src/env/load_env.rs
vendored
@ -1,9 +1,4 @@
|
||||
use nu_engine::{current_dir, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, Record, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct LoadEnv;
|
||||
|
13
crates/nu-command/src/env/source_env.rs
vendored
13
crates/nu-command/src/env/source_env.rs
vendored
@ -1,15 +1,8 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use nu_engine::{
|
||||
find_in_dirs_env, get_dirs_var_from_call, get_eval_block_with_early_return, redirect_env,
|
||||
CallExt,
|
||||
};
|
||||
use nu_protocol::ast::Call;
|
||||
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
|
||||
command_prelude::*, find_in_dirs_env, get_dirs_var_from_call, get_eval_block_with_early_return,
|
||||
redirect_env,
|
||||
};
|
||||
use std::path::PathBuf;
|
||||
|
||||
/// Source a file for environment variables.
|
||||
#[derive(Clone)]
|
||||
|
10
crates/nu-command/src/env/with_env.rs
vendored
10
crates/nu-command/src/env/with_env.rs
vendored
@ -1,13 +1,7 @@
|
||||
use nu_engine::{command_prelude::*, eval_block};
|
||||
use nu_protocol::{debugger::WithoutDebug, engine::Closure};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use nu_engine::{eval_block, CallExt};
|
||||
use nu_protocol::debugger::WithoutDebug;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Closure, Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct WithEnv;
|
||||
|
||||
|
@ -1,8 +1,4 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct IsAdmin;
|
||||
|
@ -1,11 +1,6 @@
|
||||
#[cfg(unix)]
|
||||
use libc::gid_t;
|
||||
use nu_engine::{current_dir, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
use std::path::Path;
|
||||
|
||||
// For checking whether we have permission to cd to a directory
|
||||
|
@ -1,13 +1,8 @@
|
||||
use super::util::opt_for_glob_pattern;
|
||||
use crate::{DirBuilder, DirInfo, FileInfo};
|
||||
use nu_engine::{current_dir, CallExt};
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
use nu_glob::Pattern;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, IntoInterruptiblePipelineData, NuGlob, PipelineData, ShellError, Signature,
|
||||
Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_protocol::NuGlob;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,13 +1,5 @@
|
||||
use nu_engine::env::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::Arc;
|
||||
use nu_engine::{command_prelude::*, env::current_dir};
|
||||
use std::sync::{atomic::AtomicBool, Arc};
|
||||
use wax::{Glob as WaxGlob, WalkBehavior, WalkEntry};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,25 +1,19 @@
|
||||
use super::util::opt_for_glob_pattern;
|
||||
use crate::DirBuilder;
|
||||
use crate::DirInfo;
|
||||
use crate::{DirBuilder, DirInfo};
|
||||
use chrono::{DateTime, Local, LocalResult, TimeZone, Utc};
|
||||
use nu_engine::env::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_engine::{command_prelude::*, env::current_dir};
|
||||
use nu_glob::{MatchOptions, Pattern};
|
||||
use nu_path::expand_to_real_path;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::NuGlob;
|
||||
use nu_protocol::{
|
||||
Category, DataSource, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData,
|
||||
PipelineMetadata, Record, ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_protocol::{DataSource, NuGlob, PipelineMetadata};
|
||||
use pathdiff::diff_paths;
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::PathBuf;
|
||||
use std::sync::Arc;
|
||||
use std::time::{SystemTime, UNIX_EPOCH};
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::Arc,
|
||||
time::{SystemTime, UNIX_EPOCH},
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Ls;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::env::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, env::current_dir};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,13 +1,7 @@
|
||||
use super::util::get_rest_for_glob_pattern;
|
||||
use nu_engine::{current_dir, get_eval_block, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::util::BufferedReader;
|
||||
use nu_protocol::{
|
||||
Category, DataSource, Example, IntoInterruptiblePipelineData, NuGlob, PipelineData,
|
||||
PipelineMetadata, RawStream, ShellError, Signature, Spanned, SyntaxShape, Type,
|
||||
};
|
||||
use std::io::BufReader;
|
||||
use nu_engine::{command_prelude::*, current_dir, get_eval_block};
|
||||
use nu_protocol::{BufferedReader, DataSource, NuGlob, PipelineMetadata, RawStream};
|
||||
use std::{io::BufReader, path::Path};
|
||||
|
||||
#[cfg(feature = "sqlite")]
|
||||
use crate::database::SQLiteDatabase;
|
||||
@ -17,7 +11,6 @@ use nu_protocol::IntoPipelineData;
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::fs::PermissionsExt;
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Open;
|
||||
|
@ -1,22 +1,14 @@
|
||||
use std::collections::HashMap;
|
||||
use std::io::Error;
|
||||
use std::io::ErrorKind;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::prelude::FileTypeExt;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use super::util::get_rest_for_glob_pattern;
|
||||
use super::util::try_interaction;
|
||||
|
||||
use nu_engine::env::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use super::util::{get_rest_for_glob_pattern, try_interaction};
|
||||
use nu_engine::{command_prelude::*, env::current_dir};
|
||||
use nu_glob::MatchOptions;
|
||||
use nu_path::expand_path_with;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, NuGlob, PipelineData, ShellError, Signature,
|
||||
Span, Spanned, SyntaxShape, Type, Value,
|
||||
use nu_protocol::NuGlob;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::prelude::FileTypeExt;
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
io::{Error, ErrorKind},
|
||||
path::PathBuf,
|
||||
};
|
||||
|
||||
const TRASH_SUPPORTED: bool = cfg!(all(
|
||||
|
@ -1,19 +1,16 @@
|
||||
use nu_engine::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_path::expand_path_with;
|
||||
use nu_protocol::ast::{Call, Expr, Expression};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::IntoSpanned;
|
||||
use nu_protocol::{
|
||||
Category, DataSource, Example, IoStream, PipelineData, PipelineMetadata, RawStream, ShellError,
|
||||
Signature, Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use std::fs::File;
|
||||
use std::io::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::thread;
|
||||
|
||||
use crate::progress_bar;
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
use nu_path::expand_path_with;
|
||||
use nu_protocol::{
|
||||
ast::{Expr, Expression},
|
||||
DataSource, IoStream, PipelineMetadata, RawStream,
|
||||
};
|
||||
use std::{
|
||||
fs::File,
|
||||
io::Write,
|
||||
path::{Path, PathBuf},
|
||||
thread,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Save;
|
||||
|
@ -1,15 +1,11 @@
|
||||
use itertools::Itertools;
|
||||
use nu_engine::env_to_strings;
|
||||
use nu_engine::CallExt;
|
||||
use nu_engine::{command_prelude::*, env_to_strings};
|
||||
use nu_path::canonicalize_with;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type,
|
||||
use std::{
|
||||
ffi::{OsStr, OsString},
|
||||
path::Path,
|
||||
process::Stdio,
|
||||
};
|
||||
use std::ffi::{OsStr, OsString};
|
||||
use std::path::Path;
|
||||
use std::process::Stdio;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Start;
|
||||
|
@ -1,14 +1,7 @@
|
||||
use std::path::Path;
|
||||
use std::{fs::OpenOptions, time::SystemTime};
|
||||
|
||||
use filetime::FileTime;
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type,
|
||||
};
|
||||
use std::{fs::OpenOptions, path::Path, time::SystemTime};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Touch;
|
||||
|
@ -1,10 +1,5 @@
|
||||
use super::util::get_rest_for_glob_pattern;
|
||||
use nu_engine::{current_dir, CallExt};
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
use std::path::PathBuf;
|
||||
use uu_cp::{BackupMode, CopyMode, UpdateMode};
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type};
|
||||
use std::path::PathBuf;
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use uu_mkdir::mkdir;
|
||||
#[cfg(not(windows))]
|
||||
use uucore::mode;
|
||||
|
@ -1,13 +1,8 @@
|
||||
use super::util::get_rest_for_glob_pattern;
|
||||
use nu_engine::current_dir;
|
||||
use nu_engine::CallExt;
|
||||
use nu_engine::{command_prelude::*, current_dir};
|
||||
use nu_path::expand_path_with;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::NuGlob;
|
||||
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type};
|
||||
use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::{ffi::OsString, path::PathBuf};
|
||||
use uu_mv::{BackupMode, UpdateMode};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,14 +1,10 @@
|
||||
use dialoguer::Input;
|
||||
use nu_engine::get_eval_expression;
|
||||
use nu_protocol::ast::Expr;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{EngineState, Stack},
|
||||
ShellError, Spanned, Value,
|
||||
use nu_engine::{command_prelude::*, get_eval_expression};
|
||||
use nu_protocol::{ast::Expr, FromValue, NuGlob};
|
||||
use std::{
|
||||
error::Error,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
use nu_protocol::{FromValue, NuGlob, Type};
|
||||
use std::error::Error;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
|
||||
pub struct Resource {
|
||||
|
@ -1,7 +1,3 @@
|
||||
use std::path::PathBuf;
|
||||
use std::sync::mpsc::{channel, RecvTimeoutError};
|
||||
use std::time::Duration;
|
||||
|
||||
use notify_debouncer_full::{
|
||||
new_debouncer,
|
||||
notify::{
|
||||
@ -9,13 +5,15 @@ use notify_debouncer_full::{
|
||||
EventKind, RecursiveMode, Watcher,
|
||||
},
|
||||
};
|
||||
use nu_engine::{current_dir, get_eval_block, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack, StateWorkingSet};
|
||||
use nu_engine::{command_prelude::*, current_dir, get_eval_block};
|
||||
use nu_protocol::{
|
||||
format_error, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
engine::{Closure, StateWorkingSet},
|
||||
format_error,
|
||||
};
|
||||
use std::{
|
||||
path::PathBuf,
|
||||
sync::mpsc::{channel, RecvTimeoutError},
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
// durations chosen mostly arbitrarily
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
use super::utils;
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct All;
|
||||
|
@ -1,10 +1,5 @@
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
use super::utils;
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Any;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
|
||||
Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Append;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::column::get_columns;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::{column::get_columns, command_prelude::*};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Columns;
|
||||
|
@ -1,8 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::Call, engine::Command, engine::EngineState, engine::Stack, record, Category, Example,
|
||||
PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Compact;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Spanned,
|
||||
SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Default;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData,
|
||||
ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
use std::collections::HashSet;
|
||||
|
||||
|
@ -1,11 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature,
|
||||
SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Drop;
|
||||
|
@ -1,11 +1,6 @@
|
||||
use itertools::Either;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, RangeInclusion};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, PipelineIterator, Range,
|
||||
ShellError, Signature, Span, Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::{ast::RangeInclusion, PipelineIterator, Range};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct DropNth;
|
||||
|
@ -1,13 +1,6 @@
|
||||
use nu_engine::{get_eval_block_with_early_return, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
|
||||
Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
use super::utils::chain_error_with_input;
|
||||
use nu_engine::{command_prelude::*, get_eval_block_with_early_return};
|
||||
use nu_protocol::engine::Closure;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Each;
|
||||
|
@ -1,7 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, CellPath};
|
||||
use nu_protocol::engine::{EngineState, Stack};
|
||||
use nu_protocol::{IntoPipelineData, PipelineData, ShellError, Value};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
pub fn empty(
|
||||
engine_state: &EngineState,
|
||||
|
@ -1,9 +1,4 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Enumerate;
|
||||
|
@ -1,11 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
|
||||
SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Every;
|
||||
|
@ -1,12 +1,6 @@
|
||||
use super::utils::chain_error_with_input;
|
||||
use nu_engine::{get_eval_block_with_early_return, CallExt};
|
||||
use nu_protocol::ast::Call;
|
||||
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData,
|
||||
ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::{command_prelude::*, get_eval_block_with_early_return};
|
||||
use nu_protocol::engine::Closure;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Filter;
|
||||
|
@ -1,15 +1,9 @@
|
||||
use crate::help::highlight_search_string;
|
||||
|
||||
use fancy_regex::Regex;
|
||||
use nu_ansi_term::Style;
|
||||
use nu_color_config::StyleComputer;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Command, EngineState, Stack},
|
||||
record, Category, Config, Example, IntoInterruptiblePipelineData, IntoPipelineData, ListStream,
|
||||
PipelineData, Record, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::{Config, ListStream};
|
||||
use nu_utils::IgnoreCaseExt;
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
|
||||
Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct First;
|
||||
|
@ -1,12 +1,6 @@
|
||||
use indexmap::IndexMap;
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, CellPath, PathMember};
|
||||
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, PipelineData, Record, ShellError, Signature, Span, SyntaxShape,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::ast::PathMember;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Flatten;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::{Call, CellPath};
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, IntoPipelineData, PipelineData, ShellError,
|
||||
Signature, Span, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Get;
|
||||
|
@ -1,10 +1,4 @@
|
||||
use nu_engine::CallExt;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Spanned, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Group;
|
||||
|
@ -1,12 +1,6 @@
|
||||
use nu_engine::{get_eval_block, CallExt};
|
||||
use nu_protocol::ast::{Call, CellPath};
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, IntoPipelineData, PipelineData, Record, ShellError, Signature, Span,
|
||||
SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
use indexmap::IndexMap;
|
||||
use nu_engine::{command_prelude::*, get_eval_block};
|
||||
use nu_protocol::engine::Closure;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct GroupBy;
|
||||
|
@ -1,9 +1,5 @@
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
record, Category, Config, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span,
|
||||
Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
use nu_protocol::Config;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Headers;
|
||||
|
@ -1,10 +1,8 @@
|
||||
use nu_engine::{get_eval_block, CallExt, EvalBlockFn};
|
||||
use nu_protocol::ast::{Block, Call, CellPath, PathMember};
|
||||
|
||||
use nu_protocol::engine::{Closure, Command, EngineState, Stack};
|
||||
use nu_engine::{command_prelude::*, get_eval_block, EvalBlockFn};
|
||||
use nu_protocol::{
|
||||
record, Category, Example, FromValue, IntoInterruptiblePipelineData, IntoPipelineData,
|
||||
PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
|
||||
ast::{Block, PathMember},
|
||||
engine::Closure,
|
||||
FromValue,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
@ -1,13 +1,7 @@
|
||||
use nu_engine::{command_prelude::*, get_eval_block_with_early_return};
|
||||
use nu_protocol::engine::Closure;
|
||||
use std::{sync::mpsc, thread};
|
||||
|
||||
use nu_engine::{get_eval_block_with_early_return, CallExt};
|
||||
use nu_protocol::{
|
||||
ast::Call,
|
||||
engine::{Closure, Command, EngineState, Stack},
|
||||
Category, Example, IntoInterruptiblePipelineData, PipelineData, ShellError, Signature,
|
||||
SyntaxShape, Type, Value,
|
||||
};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Interleave;
|
||||
|
||||
|
@ -1,9 +1,5 @@
|
||||
use crate::filters::empty::empty;
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{
|
||||
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
|
||||
};
|
||||
use nu_engine::command_prelude::*;
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct IsEmpty;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user