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:
Ian Manske 2024-03-26 21:17:30 +00:00 committed by GitHub
parent f8c1e3ac61
commit c747ec75c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
660 changed files with 1634 additions and 4332 deletions

View File

@ -1,9 +1,4 @@
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,9 +1,4 @@
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct SubCommand; pub struct SubCommand;

View File

@ -1,8 +1,4 @@
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
};
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,9 +1,5 @@
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
use unicode_segmentation::UnicodeSegmentation; use unicode_segmentation::UnicodeSegmentation;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,6 +1,5 @@
use nu_protocol::engine::{EngineState, StateWorkingSet};
use crate::commands::*; use crate::commands::*;
use nu_protocol::engine::{EngineState, StateWorkingSet};
pub fn add_cli_context(mut engine_state: EngineState) -> EngineState { pub fn add_cli_context(mut engine_state: EngineState) -> EngineState {
let delta = { let delta = {

View File

@ -1,10 +1,5 @@
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::ast::Call; use nu_protocol::HistoryFileFormat;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
record, Category, Example, HistoryFileFormat, IntoInterruptiblePipelineData, PipelineData,
ShellError, Signature, Span, Type, Value,
};
use reedline::{ use reedline::{
FileBackedHistory, History as ReedlineHistory, HistoryItem, SearchDirection, SearchQuery, FileBackedHistory, History as ReedlineHistory, HistoryItem, SearchDirection, SearchQuery,
SqliteBackedHistory, SqliteBackedHistory,

View File

@ -1,8 +1,4 @@
use nu_protocol::ast::Call; use nu_engine::command_prelude::*;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct HistorySession; pub struct HistorySession;

View File

@ -1,9 +1,4 @@
use nu_engine::get_full_help; use nu_engine::{command_prelude::*, get_full_help};
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Keybindings; pub struct Keybindings;

View File

@ -1,8 +1,4 @@
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Type, Value,
};
use reedline::get_reedline_default_keybindings; use reedline::get_reedline_default_keybindings;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,9 +1,4 @@
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type,
Value,
};
use reedline::{ use reedline::{
get_reedline_edit_commands, get_reedline_keybinding_modifiers, get_reedline_keycodes, get_reedline_edit_commands, get_reedline_keybinding_modifiers, get_reedline_keycodes,
get_reedline_prompt_edit_modes, get_reedline_reedline_events, get_reedline_prompt_edit_modes, get_reedline_reedline_events,

View File

@ -1,12 +1,7 @@
use crossterm::execute; use crossterm::{
use crossterm::QueueableCommand; event::Event, event::KeyCode, event::KeyEvent, execute, terminal, QueueableCommand,
use crossterm::{event::Event, event::KeyCode, event::KeyEvent, terminal};
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Span, Type,
Value,
}; };
use nu_engine::command_prelude::*;
use std::io::{stdout, Write}; use std::io::{stdout, Write};
#[derive(Clone)] #[derive(Clone)]

View File

@ -5,14 +5,13 @@ use crate::completions::{
use nu_color_config::{color_record_to_nustyle, lookup_ansi_color_style}; use nu_color_config::{color_record_to_nustyle, lookup_ansi_color_style};
use nu_engine::eval_block; use nu_engine::eval_block;
use nu_parser::{flatten_pipeline_element, parse, FlatShape}; use nu_parser::{flatten_pipeline_element, parse, FlatShape};
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::{ use nu_protocol::{
debugger::WithoutDebug,
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
BlockId, PipelineData, Span, Value, BlockId, PipelineData, Span, Value,
}; };
use reedline::{Completer as ReedlineCompleter, Suggestion}; use reedline::{Completer as ReedlineCompleter, Suggestion};
use std::str; use std::{str, sync::Arc};
use std::sync::Arc;
use super::base::{SemanticSuggestion, SuggestionKind}; use super::base::{SemanticSuggestion, SuggestionKind};

View File

@ -2,11 +2,15 @@ use crate::completions::{matches, CompletionOptions};
use nu_ansi_term::Style; use nu_ansi_term::Style;
use nu_engine::env_to_string; use nu_engine::env_to_string;
use nu_path::home_dir; use nu_path::home_dir;
use nu_protocol::engine::{EngineState, Stack}; use nu_protocol::{
use nu_protocol::{engine::StateWorkingSet, Span}; engine::{EngineState, Stack, StateWorkingSet},
Span,
};
use nu_utils::get_ls_colors; use nu_utils::get_ls_colors;
use std::ffi::OsStr; use std::{
use std::path::{is_separator, Component, Path, PathBuf, MAIN_SEPARATOR as SEP}; ffi::OsStr,
path::{is_separator, Component, Path, PathBuf, MAIN_SEPARATOR as SEP},
};
fn complete_rec( fn complete_rec(
partial: &[String], partial: &[String],

View File

@ -1,8 +1,7 @@
use std::fmt::Display;
use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher}; use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher};
use nu_parser::trim_quotes_str; use nu_parser::trim_quotes_str;
use nu_protocol::CompletionAlgorithm; use nu_protocol::CompletionAlgorithm;
use std::fmt::Display;
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
pub enum SortBy { pub enum SortBy {

View File

@ -1,17 +1,16 @@
use crate::completions::{Completer, CompletionOptions, MatchAlgorithm, SortBy}; use crate::completions::{
completer::map_value_completions, Completer, CompletionOptions, MatchAlgorithm,
SemanticSuggestion, SortBy,
};
use nu_engine::eval_call; use nu_engine::eval_call;
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::{ use nu_protocol::{
ast::{Argument, Call, Expr, Expression}, ast::{Argument, Call, Expr, Expression},
debugger::WithoutDebug,
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
PipelineData, Span, Type, Value, PipelineData, Span, Type, Value,
}; };
use nu_utils::IgnoreCaseExt; use nu_utils::IgnoreCaseExt;
use std::collections::HashMap; use std::{collections::HashMap, sync::Arc};
use std::sync::Arc;
use super::base::SemanticSuggestion;
use super::completer::map_value_completions;
pub struct CustomCompletion { pub struct CustomCompletion {
engine_state: Arc<EngineState>, engine_state: Arc<EngineState>,

View File

@ -8,8 +8,10 @@ use nu_protocol::{
levenshtein_distance, Span, levenshtein_distance, Span,
}; };
use reedline::Suggestion; use reedline::Suggestion;
use std::path::{Path, MAIN_SEPARATOR as SEP}; use std::{
use std::sync::Arc; path::{Path, MAIN_SEPARATOR as SEP},
sync::Arc,
};
use super::SemanticSuggestion; use super::SemanticSuggestion;

View File

@ -9,8 +9,10 @@ use nu_protocol::{
}; };
use nu_utils::IgnoreCaseExt; use nu_utils::IgnoreCaseExt;
use reedline::Suggestion; use reedline::Suggestion;
use std::path::{Path, MAIN_SEPARATOR as SEP}; use std::{
use std::sync::Arc; path::{Path, MAIN_SEPARATOR as SEP},
sync::Arc,
};
use super::SemanticSuggestion; use super::SemanticSuggestion;

View File

@ -4,7 +4,6 @@ use nu_protocol::{
engine::StateWorkingSet, engine::StateWorkingSet,
Span, Span,
}; };
use reedline::Suggestion; use reedline::Suggestion;
use super::SemanticSuggestion; use super::SemanticSuggestion;

View File

@ -1,15 +1,13 @@
use crate::completions::{Completer, CompletionOptions}; use crate::completions::{
Completer, CompletionOptions, MatchAlgorithm, SemanticSuggestion, SuggestionKind,
};
use nu_engine::{column::get_columns, eval_variable}; use nu_engine::{column::get_columns, eval_variable};
use nu_protocol::{ use nu_protocol::{
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
Span, Value, Span, Value,
}; };
use reedline::Suggestion; use reedline::Suggestion;
use std::str; use std::{str, sync::Arc};
use std::sync::Arc;
use super::{MatchAlgorithm, SemanticSuggestion, SuggestionKind};
#[derive(Clone)] #[derive(Clone)]
pub struct VariableCompletion { pub struct VariableCompletion {

View File

@ -1,9 +1,10 @@
use crate::util::eval_source; use crate::util::eval_source;
#[cfg(feature = "plugin")] #[cfg(feature = "plugin")]
use nu_path::canonicalize_with; use nu_path::canonicalize_with;
use nu_protocol::engine::{EngineState, Stack, StateWorkingSet}; use nu_protocol::{
use nu_protocol::report_error; engine::{EngineState, Stack, StateWorkingSet},
use nu_protocol::{HistoryFileFormat, PipelineData}; report_error, HistoryFileFormat, PipelineData,
};
#[cfg(feature = "plugin")] #[cfg(feature = "plugin")]
use nu_protocol::{ParseError, Spanned}; use nu_protocol::{ParseError, Spanned};
#[cfg(feature = "plugin")] #[cfg(feature = "plugin")]

View File

@ -2,12 +2,10 @@ use log::info;
use miette::Result; use miette::Result;
use nu_engine::{convert_env_values, eval_block}; use nu_engine::{convert_env_values, eval_block};
use nu_parser::parse; use nu_parser::parse;
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::engine::Stack;
use nu_protocol::report_error;
use nu_protocol::{ use nu_protocol::{
engine::{EngineState, StateWorkingSet}, debugger::WithoutDebug,
PipelineData, Spanned, Value, engine::{EngineState, Stack, StateWorkingSet},
report_error, PipelineData, Spanned, Value,
}; };
/// Run a command (or commands) given to us by the user /// Run a command (or commands) given to us by the user

View File

@ -1,21 +1,17 @@
use std::sync::Arc;
use crate::util::eval_source; use crate::util::eval_source;
use log::info; use log::{info, trace};
use log::trace;
use miette::{IntoDiagnostic, Result}; use miette::{IntoDiagnostic, Result};
use nu_engine::eval_block; use nu_engine::{convert_env_values, current_dir, eval_block};
use nu_engine::{convert_env_values, current_dir};
use nu_parser::parse; use nu_parser::parse;
use nu_path::canonicalize_with; use nu_path::canonicalize_with;
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::report_error;
use nu_protocol::{ use nu_protocol::{
ast::Call, ast::Call,
debugger::WithoutDebug,
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
Config, PipelineData, ShellError, Span, Value, report_error, Config, PipelineData, ShellError, Span, Value,
}; };
use nu_utils::stdout_write_all_and_flush; use nu_utils::stdout_write_all_and_flush;
use std::sync::Arc;
/// Main function used when a file path is found as argument for nu /// Main function used when a file path is found as argument for nu
pub fn evaluate_file( pub fn evaluate_file(

View File

@ -2,8 +2,7 @@ use nu_engine::documentation::get_flags_section;
use nu_protocol::{engine::EngineState, levenshtein_distance}; use nu_protocol::{engine::EngineState, levenshtein_distance};
use nu_utils::IgnoreCaseExt; use nu_utils::IgnoreCaseExt;
use reedline::{Completer, Suggestion}; use reedline::{Completer, Suggestion};
use std::fmt::Write; use std::{fmt::Write, sync::Arc};
use std::sync::Arc;
pub struct NuHelpCompleter(Arc<EngineState>); pub struct NuHelpCompleter(Arc<EngineState>);

View File

@ -1,6 +1,6 @@
use nu_engine::eval_block; use nu_engine::eval_block;
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::{ use nu_protocol::{
debugger::WithoutDebug,
engine::{EngineState, Stack}, engine::{EngineState, Stack},
IntoPipelineData, Span, Value, IntoPipelineData, Span, Value,
}; };

View File

@ -1,6 +1,4 @@
use nu_protocol::ast::Call; use nu_engine::command_prelude::*;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Type, Value};
use reedline::{Highlighter, StyledText}; use reedline::{Highlighter, StyledText};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,4 @@
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::ast::Call;
use nu_protocol::engine::{Command, EngineState, Stack};
use nu_protocol::{
Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type,
Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct Print; pub struct Print;

View File

@ -1,13 +1,11 @@
use crate::prompt_update::{POST_PROMPT_MARKER, PRE_PROMPT_MARKER}; use crate::prompt_update::{POST_PROMPT_MARKER, PRE_PROMPT_MARKER};
#[cfg(windows)] #[cfg(windows)]
use nu_utils::enable_vt_processing; use nu_utils::enable_vt_processing;
use reedline::DefaultPrompt; use reedline::{
use { DefaultPrompt, Prompt, PromptEditMode, PromptHistorySearch, PromptHistorySearchStatus,
reedline::{ PromptViMode,
Prompt, PromptEditMode, PromptHistorySearch, PromptHistorySearchStatus, PromptViMode,
},
std::borrow::Cow,
}; };
use std::borrow::Cow;
/// Nushell prompt definition /// Nushell prompt definition
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,11 +1,9 @@
use crate::NushellPrompt; use crate::NushellPrompt;
use log::trace; use log::trace;
use nu_engine::get_eval_subexpression; use nu_engine::get_eval_subexpression;
use nu_protocol::report_error;
use nu_protocol::{ use nu_protocol::{
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
Config, PipelineData, Value, report_error, Config, PipelineData, Value,
}; };
use reedline::Prompt; use reedline::Prompt;

View File

@ -3,9 +3,9 @@ use crossterm::event::{KeyCode, KeyModifiers};
use nu_color_config::{color_record_to_nustyle, lookup_ansi_color_style}; use nu_color_config::{color_record_to_nustyle, lookup_ansi_color_style};
use nu_engine::eval_block; use nu_engine::eval_block;
use nu_parser::parse; use nu_parser::parse;
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::{ use nu_protocol::{
create_menus, create_menus,
debugger::WithoutDebug,
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
extract_value, Config, EditBindings, ParsedKeybinding, ParsedMenu, PipelineData, Record, extract_value, Config, EditBindings, ParsedKeybinding, ParsedMenu, PipelineData, Record,
ShellError, Span, Value, ShellError, Span, Value,
@ -1311,9 +1311,8 @@ fn extract_char(value: &Value, config: &Config) -> Result<char, ShellError> {
#[cfg(test)] #[cfg(test)]
mod test { mod test {
use nu_protocol::record;
use super::*; use super::*;
use nu_protocol::record;
#[test] #[test]
fn test_send_event() { fn test_send_event() {

View File

@ -9,8 +9,10 @@ use crate::{
use crossterm::cursor::SetCursorStyle; use crossterm::cursor::SetCursorStyle;
use log::{error, trace, warn}; use log::{error, trace, warn};
use miette::{ErrReport, IntoDiagnostic, Result}; use miette::{ErrReport, IntoDiagnostic, Result};
use nu_cmd_base::util::get_guaranteed_cwd; use nu_cmd_base::{
use nu_cmd_base::{hook::eval_hook, util::get_editor}; hook::eval_hook,
util::{get_editor, get_guaranteed_cwd},
};
use nu_color_config::StyleComputer; use nu_color_config::StyleComputer;
use nu_engine::{convert_env_values, env_to_strings}; use nu_engine::{convert_env_values, env_to_strings};
use nu_parser::{lex, parse, trim_quotes_str}; use nu_parser::{lex, parse, trim_quotes_str};
@ -31,8 +33,7 @@ use std::{
env::temp_dir, env::temp_dir,
io::{self, IsTerminal, Write}, io::{self, IsTerminal, Write},
panic::{catch_unwind, AssertUnwindSafe}, panic::{catch_unwind, AssertUnwindSafe},
path::Path, path::{Path, PathBuf},
path::PathBuf,
sync::{atomic::Ordering, Arc}, sync::{atomic::Ordering, Arc},
time::{Duration, Instant}, time::{Duration, Instant},
}; };

View File

@ -3,9 +3,11 @@ use nu_ansi_term::Style;
use nu_color_config::{get_matching_brackets_style, get_shape_color}; use nu_color_config::{get_matching_brackets_style, get_shape_color};
use nu_engine::env; use nu_engine::env;
use nu_parser::{flatten_block, parse, FlatShape}; use nu_parser::{flatten_block, parse, FlatShape};
use nu_protocol::ast::{Argument, Block, Expr, Expression, PipelineRedirection, RecordItem}; use nu_protocol::{
use nu_protocol::engine::{EngineState, Stack, StateWorkingSet}; ast::{Argument, Block, Expr, Expression, PipelineRedirection, RecordItem},
use nu_protocol::{Config, Span}; engine::{EngineState, Stack, StateWorkingSet},
Config, Span,
};
use reedline::{Highlighter, StyledText}; use reedline::{Highlighter, StyledText};
use std::sync::Arc; use std::sync::Arc;

View File

@ -1,13 +1,11 @@
use nu_cmd_base::hook::eval_hook; use nu_cmd_base::hook::eval_hook;
use nu_engine::{eval_block, eval_block_with_early_return}; use nu_engine::{eval_block, eval_block_with_early_return};
use nu_parser::{escape_quote_string, lex, parse, unescape_unquote_string, Token, TokenContents}; use nu_parser::{escape_quote_string, lex, parse, unescape_unquote_string, Token, TokenContents};
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::engine::StateWorkingSet;
use nu_protocol::{ use nu_protocol::{
engine::{EngineState, Stack}, debugger::WithoutDebug,
print_if_stream, PipelineData, ShellError, Span, Value, engine::{EngineState, Stack, StateWorkingSet},
print_if_stream, report_error, report_error_new, PipelineData, ShellError, Span, Value,
}; };
use nu_protocol::{report_error, report_error_new};
#[cfg(windows)] #[cfg(windows)]
use nu_utils::enable_vt_processing; use nu_utils::enable_vt_processing;
use nu_utils::utils::perf; use nu_utils::utils::perf;

View File

@ -1,12 +1,11 @@
pub mod support; pub mod support;
use std::path::PathBuf;
use nu_cli::NuCompleter; use nu_cli::NuCompleter;
use nu_parser::parse; use nu_parser::parse;
use nu_protocol::engine::StateWorkingSet; use nu_protocol::engine::StateWorkingSet;
use reedline::{Completer, Suggestion}; use reedline::{Completer, Suggestion};
use rstest::{fixture, rstest}; use rstest::{fixture, rstest};
use std::path::PathBuf;
use support::{ use support::{
completions_helpers::{new_partial_engine, new_quote_engine}, completions_helpers::{new_partial_engine, new_quote_engine},
file, folder, match_suggestions, new_engine, file, folder, match_suggestions, new_engine,

View File

@ -1,15 +1,14 @@
use std::path::PathBuf;
use nu_engine::eval_block; use nu_engine::eval_block;
use nu_parser::parse; use nu_parser::parse;
use nu_protocol::debugger::WithoutDebug;
use nu_protocol::{ use nu_protocol::{
debugger::WithoutDebug,
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
eval_const::create_nu_constant, eval_const::create_nu_constant,
PipelineData, ShellError, Span, Value, NU_VARIABLE_ID, PipelineData, ShellError, Span, Value, NU_VARIABLE_ID,
}; };
use nu_test_support::fs; use nu_test_support::fs;
use reedline::Suggestion; use reedline::Suggestion;
use std::path::PathBuf;
const SEP: char = std::path::MAIN_SEPARATOR; const SEP: char = std::path::MAIN_SEPARATOR;

View File

@ -1,13 +1,14 @@
use std::sync::Arc;
use crate::util::get_guaranteed_cwd; use crate::util::get_guaranteed_cwd;
use miette::Result; use miette::Result;
use nu_engine::{eval_block, eval_block_with_early_return}; use nu_engine::{eval_block, eval_block_with_early_return};
use nu_parser::parse; use nu_parser::parse;
use nu_protocol::cli_error::{report_error, report_error_new}; use nu_protocol::{
use nu_protocol::debugger::WithoutDebug; cli_error::{report_error, report_error_new},
use nu_protocol::engine::{EngineState, Stack, StateWorkingSet}; debugger::WithoutDebug,
use nu_protocol::{BlockId, PipelineData, PositionalArg, ShellError, Span, Type, Value, VarId}; engine::{EngineState, Stack, StateWorkingSet},
BlockId, PipelineData, PositionalArg, ShellError, Span, Type, Value, VarId,
};
use std::sync::Arc;
pub fn eval_env_change_hook( pub fn eval_env_change_hook(
env_change_hook: Option<Value>, env_change_hook: Option<Value>,

View File

@ -1,7 +1,5 @@
use nu_protocol::ast::CellPath; use nu_protocol::{ast::CellPath, PipelineData, ShellError, Span, Value};
use nu_protocol::{PipelineData, ShellError, Span, Value}; use std::sync::{atomic::AtomicBool, Arc};
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
pub trait CmdArgument { pub trait CmdArgument {
fn take_cell_paths(&mut self) -> Option<Vec<CellPath>>; fn take_cell_paths(&mut self) -> Option<Vec<CellPath>>;

View File

@ -1,8 +1,7 @@
use nu_protocol::report_error;
use nu_protocol::{ use nu_protocol::{
ast::RangeInclusion, ast::RangeInclusion,
engine::{EngineState, Stack, StateWorkingSet}, engine::{EngineState, Stack, StateWorkingSet},
Range, ShellError, Span, Value, report_error, Range, ShellError, Span, Value,
}; };
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -1,11 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{Axis, Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use super::super::values::{Axis, Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct AppendDF; pub struct AppendDF;

View File

@ -1,12 +1,6 @@
use crate::dataframe::values::{str_to_dtype, NuExpression, NuLazyFrame}; use crate::dataframe::values::{str_to_dtype, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::command_prelude::*;
use super::super::values::NuDataFrame;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::*; use polars::prelude::*;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,9 +1,5 @@
use super::super::values::NuDataFrame; use crate::dataframe::values::NuDataFrame;
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct ColumnsDF; pub struct ColumnsDF;

View File

@ -1,12 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{utils::convert_columns, Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use super::super::values::utils::convert_columns;
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct DropDF; pub struct DropDF;

View File

@ -1,13 +1,7 @@
use nu_engine::CallExt; use crate::dataframe::values::{utils::convert_columns_string, Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::UniqueKeepStrategy;
use super::super::values::utils::convert_columns_string; use polars::prelude::UniqueKeepStrategy;
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct DropDuplicates; pub struct DropDuplicates;

View File

@ -1,12 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{utils::convert_columns_string, Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use super::super::values::utils::convert_columns_string;
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct DropNulls; pub struct DropNulls;

View File

@ -1,9 +1,5 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct DataTypes; pub struct DataTypes;

View File

@ -1,10 +1,6 @@
use super::super::values::NuDataFrame; use crate::dataframe::values::NuDataFrame;
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type,
};
use polars::{prelude::*, series::Series}; use polars::{prelude::*, series::Series};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,15 +1,8 @@
use nu_engine::CallExt; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::LazyFrame; use polars::prelude::LazyFrame;
use crate::dataframe::values::{NuExpression, NuLazyFrame};
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct FilterWith; pub struct FilterWith;

View File

@ -1,10 +1,5 @@
use super::super::values::{Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct FirstDF; pub struct FirstDF;

View File

@ -1,13 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{utils::convert_columns_string, Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use crate::dataframe::values::utils::convert_columns_string;
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct GetDF; pub struct GetDF;

View File

@ -1,10 +1,5 @@
use super::super::values::{utils::DEFAULT_ROWS, Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{utils::DEFAULT_ROWS, Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LastDF; pub struct LastDF;

View File

@ -1,10 +1,5 @@
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, Value,
};
use crate::dataframe::values::NuDataFrame; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct ListDF; pub struct ListDF;

View File

@ -1,14 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{utils::convert_columns_string, Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type,
Value,
};
use crate::dataframe::values::utils::convert_columns_string;
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct MeltDF; pub struct MeltDF;

View File

@ -1,21 +1,12 @@
use crate::dataframe::values::NuSchema; use crate::dataframe::values::{NuDataFrame, NuLazyFrame, NuSchema};
use nu_engine::command_prelude::*;
use super::super::values::{NuDataFrame, NuLazyFrame};
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
};
use std::{fs::File, io::BufReader, path::PathBuf};
use polars::prelude::{ use polars::prelude::{
CsvEncoding, CsvReader, IpcReader, JsonFormat, JsonReader, LazyCsvReader, LazyFileListReader, CsvEncoding, CsvReader, IpcReader, JsonFormat, JsonReader, LazyCsvReader, LazyFileListReader,
LazyFrame, ParallelStrategy, ParquetReader, ScanArgsIpc, ScanArgsParquet, SerReader, LazyFrame, ParallelStrategy, ParquetReader, ScanArgsIpc, ScanArgsParquet, SerReader,
}; };
use polars_io::avro::AvroReader; use polars_io::avro::AvroReader;
use std::{fs::File, io::BufReader, path::PathBuf};
#[derive(Clone)] #[derive(Clone)]
pub struct OpenDataFrame; pub struct OpenDataFrame;

View File

@ -1,12 +1,8 @@
use super::super::values::NuDataFrame; use crate::dataframe::{
use crate::dataframe::values::Column; eager::SQLContext,
use crate::dataframe::{eager::SQLContext, values::NuLazyFrame}; values::{Column, NuDataFrame, NuLazyFrame},
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
}; };
use nu_engine::command_prelude::*;
// attribution: // attribution:
// sql_context.rs, and sql_expr.rs were copied from polars-sql. thank you. // sql_context.rs, and sql_expr.rs were copied from polars-sql. thank you.

View File

@ -1,13 +1,8 @@
use nu_engine::CallExt; use crate::dataframe::{
use nu_protocol::{ utils::extract_strings,
ast::Call, values::{Column, NuDataFrame, NuLazyFrame},
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
}; };
use nu_engine::command_prelude::*;
use crate::dataframe::{utils::extract_strings, values::NuLazyFrame};
use super::super::values::{Column, NuDataFrame};
#[derive(Clone)] #[derive(Clone)]
pub struct RenameDF; pub struct RenameDF;

View File

@ -1,13 +1,7 @@
use nu_engine::CallExt; use crate::dataframe::values::NuDataFrame;
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type,
};
use polars::prelude::NamedFrom;
use polars::series::Series;
use super::super::values::NuDataFrame; use polars::{prelude::NamedFrom, series::Series};
#[derive(Clone)] #[derive(Clone)]
pub struct SampleDF; pub struct SampleDF;

View File

@ -1,10 +1,5 @@
use super::super::values::NuDataFrame; use crate::dataframe::values::NuDataFrame;
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct SchemaDF; pub struct SchemaDF;

View File

@ -1,12 +1,5 @@
use nu_protocol::{ use crate::dataframe::values::{Column, NuDataFrame};
ast::Call, use nu_engine::command_prelude::*;
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
use crate::dataframe::values::Column;
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ShapeDF; pub struct ShapeDF;

View File

@ -1,13 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use crate::dataframe::values::Column;
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct SliceDF; pub struct SliceDF;

View File

@ -1,11 +1,6 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::{ use polars::{
chunked_array::ChunkedArray, chunked_array::ChunkedArray,
prelude::{ prelude::{

View File

@ -1,15 +1,8 @@
use nu_engine::CallExt; use crate::dataframe::values::{Column, NuDataFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::DataType; use polars::prelude::DataType;
use crate::dataframe::values::Column;
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct TakeDF; pub struct TakeDF;

View File

@ -1,14 +1,8 @@
use std::{fs::File, path::PathBuf}; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
};
use polars::prelude::{IpcWriter, SerWriter}; use polars::prelude::{IpcWriter, SerWriter};
use std::{fs::File, path::PathBuf};
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ToArrow; pub struct ToArrow;

View File

@ -1,15 +1,11 @@
use std::{fs::File, path::PathBuf}; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
use nu_engine::CallExt; use polars_io::{
use nu_protocol::{ avro::{AvroCompression, AvroWriter},
ast::Call, SerWriter,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
}; };
use polars_io::avro::{AvroCompression, AvroWriter}; use std::{fs::File, path::PathBuf};
use polars_io::SerWriter;
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ToAvro; pub struct ToAvro;

View File

@ -1,14 +1,8 @@
use std::{fs::File, path::PathBuf}; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
};
use polars::prelude::{CsvWriter, SerWriter}; use polars::prelude::{CsvWriter, SerWriter};
use std::{fs::File, path::PathBuf};
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ToCSV; pub struct ToCSV;

View File

@ -1,13 +1,6 @@
use crate::dataframe::values::NuSchema; use crate::dataframe::values::{Column, NuDataFrame, NuSchema};
use nu_engine::command_prelude::*;
use super::super::values::{Column, NuDataFrame};
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::*; use polars::prelude::*;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,14 +1,8 @@
use std::{fs::File, io::BufWriter, path::PathBuf}; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
};
use polars::prelude::{JsonWriter, SerWriter}; use polars::prelude::{JsonWriter, SerWriter};
use std::{fs::File, io::BufWriter, path::PathBuf};
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ToJsonLines; pub struct ToJsonLines;

View File

@ -1,13 +1,5 @@
use nu_engine::CallExt; use crate::dataframe::values::{NuDataFrame, NuExpression};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use crate::dataframe::values::NuExpression;
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ToNu; pub struct ToNu;

View File

@ -1,14 +1,8 @@
use std::{fs::File, path::PathBuf}; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Spanned, SyntaxShape, Type, Value,
};
use polars::prelude::ParquetWriter; use polars::prelude::ParquetWriter;
use std::{fs::File, path::PathBuf};
use super::super::values::NuDataFrame;
#[derive(Clone)] #[derive(Clone)]
pub struct ToParquet; pub struct ToParquet;

View File

@ -1,11 +1,5 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use crate::dataframe::values::{NuExpression, NuLazyFrame}; use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct WithColumn; pub struct WithColumn;

View File

@ -1,11 +1,5 @@
use super::super::values::NuExpression; use crate::dataframe::values::NuExpression;
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct ExprAlias; pub struct ExprAlias;

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::arg_where; use polars::prelude::arg_where;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::NuExpression; use crate::dataframe::values::NuExpression;
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
use polars::prelude::col; use polars::prelude::col;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::concat_str; use polars::prelude::concat_str;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,14 +1,7 @@
use super::super::values::NuExpression; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use crate::dataframe::values::{Column, NuDataFrame};
use chrono::{DateTime, FixedOffset}; use chrono::{DateTime, FixedOffset};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type,
Value,
};
use polars::{ use polars::{
datatypes::{DataType, TimeUnit}, datatypes::{DataType, TimeUnit},
prelude::NamedFrom, prelude::NamedFrom,

View File

@ -2,11 +2,7 @@
/// All of these expressions have an identical body and only require /// All of these expressions have an identical body and only require
/// to have a change in the name, description and expression function /// to have a change in the name, description and expression function
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
// The structs defined in this file are structs that form part of other commands // The structs defined in this file are structs that form part of other commands
// since they share a similar name // since they share a similar name

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::{lit, DataType}; use polars::prelude::{lit, DataType};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,5 @@
use crate::dataframe::values::NuExpression; use crate::dataframe::values::NuExpression;
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
record, Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct ExprLit; pub struct ExprLit;

View File

@ -1,10 +1,5 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuWhen}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuWhen};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct ExprOtherwise; pub struct ExprOtherwise;

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::{lit, QuantileInterpolOptions}; use polars::prelude::{lit, QuantileInterpolOptions};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuWhen}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuWhen};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::when; use polars::prelude::when;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,11 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame, NuLazyGroupBy}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame, NuLazyGroupBy};
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::{datatypes::DataType, prelude::Expr}; use polars::{datatypes::DataType, prelude::Expr};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,11 +1,5 @@
use crate::dataframe::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuLazyFrame};
use nu_engine::command_prelude::*;
use super::super::values::NuLazyFrame;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazyCollect; pub struct LazyCollect;

View File

@ -1,10 +1,5 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazyExplode; pub struct LazyExplode;

View File

@ -1,11 +1,5 @@
use super::super::values::NuLazyFrame; use crate::dataframe::values::{Column, NuDataFrame, NuLazyFrame};
use crate::dataframe::values::{Column, NuDataFrame}; use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazyFetch; pub struct LazyFetch;

View File

@ -1,10 +1,5 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazyFillNA; pub struct LazyFillNA;

View File

@ -1,10 +1,5 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazyFillNull; pub struct LazyFillNull;

View File

@ -1,11 +1,5 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazyFilter; pub struct LazyFilter;

View File

@ -1,12 +1,6 @@
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use crate::dataframe::values::{Column, NuDataFrame};
use super::explode::explode; use super::explode::explode;
use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
#[derive(Clone)] #[derive(Clone)]
pub struct LazyFlatten; pub struct LazyFlatten;

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame, NuLazyGroupBy}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame, NuLazyGroupBy};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::Expr; use polars::prelude::Expr;
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::{Expr, JoinType}; use polars::prelude::{Expr, JoinType};
#[derive(Clone)] #[derive(Clone)]

View File

@ -2,11 +2,7 @@
/// All of these commands have an identical body and only require /// All of these commands have an identical body and only require
/// to have a change in the name, description and function /// to have a change in the name, description and function
use crate::dataframe::values::{Column, NuDataFrame, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuLazyFrame};
use nu_protocol::{ use nu_engine::command_prelude::*;
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
macro_rules! lazy_command { macro_rules! lazy_command {
($command: ident, $name: expr, $desc: expr, $examples: expr, $func: ident, $test: ident) => { ($command: ident, $name: expr, $desc: expr, $examples: expr, $func: ident, $test: ident) => {

View File

@ -1,10 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuLazyFrame};
use nu_engine::CallExt; use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
use polars::prelude::{lit, QuantileInterpolOptions}; use polars::prelude::{lit, QuantileInterpolOptions};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,11 +1,6 @@
use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame}; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazySelect; pub struct LazySelect;

View File

@ -1,11 +1,5 @@
use super::super::values::NuLazyFrame; use crate::dataframe::values::{Column, NuDataFrame, NuExpression, NuLazyFrame};
use crate::dataframe::values::{Column, NuDataFrame, NuExpression}; use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct LazySortBy; pub struct LazySortBy;

View File

@ -1,13 +1,5 @@
use crate::dataframe::values::NuSchema; use crate::dataframe::values::{NuDataFrame, NuLazyFrame, NuSchema};
use nu_engine::command_prelude::*;
use super::super::values::{NuDataFrame, NuLazyFrame};
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct ToLazyFrame; pub struct ToLazyFrame;

View File

@ -1,10 +1,5 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct AllFalse; pub struct AllFalse;

View File

@ -1,10 +1,5 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
#[derive(Clone)] #[derive(Clone)]
pub struct AllTrue; pub struct AllTrue;

View File

@ -1,10 +1,5 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
use polars::prelude::{ArgAgg, IntoSeries, NewChunkedArray, UInt32Chunked}; use polars::prelude::{ArgAgg, IntoSeries, NewChunkedArray, UInt32Chunked};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,10 +1,5 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Type, Value,
};
use polars::prelude::{ArgAgg, IntoSeries, NewChunkedArray, UInt32Chunked}; use polars::prelude::{ArgAgg, IntoSeries, NewChunkedArray, UInt32Chunked};
#[derive(Clone)] #[derive(Clone)]

View File

@ -1,12 +1,6 @@
use super::super::values::{Column, NuDataFrame}; use crate::dataframe::values::{Column, NuDataFrame};
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, Span, Spanned, SyntaxShape, Type,
Value,
};
use polars::prelude::{DataType, IntoSeries}; use polars::prelude::{DataType, IntoSeries};
use polars_ops::prelude::{cum_max, cum_min, cum_sum}; use polars_ops::prelude::{cum_max, cum_min, cum_sum};

View File

@ -1,11 +1,6 @@
use super::super::super::values::NuDataFrame; use crate::dataframe::values::NuDataFrame;
use nu_engine::command_prelude::*;
use nu_engine::CallExt;
use nu_protocol::{
ast::Call,
engine::{Command, EngineState, Stack},
Category, Example, PipelineData, ShellError, Signature, SyntaxShape, Type,
};
use polars::prelude::{IntoSeries, StringMethods}; use polars::prelude::{IntoSeries, StringMethods};
#[derive(Clone)] #[derive(Clone)]

Some files were not shown because too many files have changed in this diff Show More