repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/src/terminal.rs | src/terminal.rs | use std::{
io::IsTerminal,
sync::atomic::{AtomicI32, Ordering},
};
use nix::{
errno::Errno,
libc,
sys::signal::{SaFlags, SigAction, SigHandler, SigSet, Signal, killpg, raise, sigaction},
unistd::{self, Pid},
};
static INITIAL_PGID: AtomicI32 = AtomicI32::new(-1);
pub(crate) fn acquire(interac... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/src/run.rs | src/run.rs | use crate::{
command,
config_files::{self, setup_config},
};
use log::trace;
#[cfg(feature = "plugin")]
use nu_cli::read_plugin_file;
use nu_cli::{EvaluateCommandsOpts, evaluate_commands, evaluate_file, evaluate_repl};
use nu_protocol::{
PipelineData, Spanned,
engine::{EngineState, Stack},
report_sh... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/src/main.rs | src/main.rs | mod command;
mod command_context;
mod config_files;
mod experimental_options;
mod ide;
mod logger;
mod run;
mod signals;
#[cfg(unix)]
mod terminal;
mod test_bins;
use crate::{
command::parse_commandline_args,
config_files::set_config_path,
logger::{configure, logger},
};
use command::gather_commandline_arg... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/src/experimental_options.rs | src/experimental_options.rs | use std::borrow::Borrow;
use nu_protocol::{
engine::{EngineState, StateWorkingSet},
report_error::report_experimental_option_warning,
};
use crate::command::NushellCliArgs;
// 1. Parse experimental options from env
// 2. See if we should have any and disable all of them if not
// 3. Parse CLI arguments, if e... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/src/test_bins.rs | src/test_bins.rs | use nu_cmd_base::hook::{eval_env_change_hook, eval_hooks};
use nu_engine::eval_block;
use nu_parser::parse;
use nu_protocol::{
PipelineData, ShellError, Value,
debugger::WithoutDebug,
engine::{EngineState, Stack, StateWorkingSet},
report_parse_error, report_shell_error,
};
use nu_std::load_standard_libr... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/src/signals.rs | src/signals.rs | use nu_protocol::{Handlers, SignalAction, Signals, engine::EngineState};
use std::sync::{
Arc,
atomic::{AtomicBool, Ordering},
};
pub(crate) fn ctrlc_protection(engine_state: &mut EngineState) {
let interrupt = Arc::new(AtomicBool::new(false));
engine_state.set_signals(Signals::new(interrupt.clone()));... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/main.rs | tests/main.rs | extern crate nu_test_support;
mod const_;
mod eval;
mod hooks;
mod integration;
mod modules;
mod overlays;
mod parsing;
mod path;
#[cfg(feature = "plugin")]
mod plugin_persistence;
#[cfg(feature = "plugin")]
mod plugins;
mod repl;
mod scope;
mod shell;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/scope/mod.rs | tests/scope/mod.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
// Note: These tests might slightly overlap with crates/nu-command/tests/commands/help.rs
#[test]
fn scope_shows_alias() {
let actual = nu!("alias xaz = echo alia... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/integration/mod.rs | tests/integration/mod.rs | use nu_test_support::nu;
use pretty_assertions::assert_str_eq;
#[test]
fn multiword_commands_have_their_parent_commands() {
let out = nu!(r#"
scope commands
| where type == built-in and name like ' '
| where ($it.name | split row ' ' | first) not-in (
scope commands
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_converters.rs | tests/repl/test_converters.rs | use crate::repl::tests::{TestResult, run_test};
#[test]
fn from_json_1() -> TestResult {
run_test(r#"('{"name": "Fred"}' | from json).name"#, "Fred")
}
#[test]
fn from_json_2() -> TestResult {
run_test(
r#"('{"name": "Fred"}
{"name": "Sally"}' | from json -o).name.1"#,
"Sall... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_math.rs | tests/repl/test_math.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
#[test]
fn add_simple() -> TestResult {
run_test("3 + 4", "7")
}
#[test]
fn add_simple2() -> TestResult {
run_test("3 + 4 + 9", "16")
}
#[test]
fn broken_math() -> TestResult {
fail_test("3 + ", "incomplete")
}
#[test]
fn modulo1() -> TestResult... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_cell_path.rs | tests/repl/test_cell_path.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
// Tests for null / null / Value::Nothing
#[test]
fn nothing_fails_string() -> TestResult {
fail_test("let nil = null; $nil.foo", "doesn't support cell paths")
}
#[test]
fn nothing_fails_int() -> TestResult {
fail_test("let nil = null; $nil.3", "doesn... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_commandline.rs | tests/repl/test_commandline.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
#[test]
fn commandline_test_get_empty() -> TestResult {
run_test("commandline", "")
}
#[test]
fn commandline_test_append() -> TestResult {
run_test(
"commandline edit --replace '0👩❤️👩2'\n\
commandline set-cursor 2\n\
comman... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_help.rs | tests/repl/test_help.rs | use crate::repl::tests::{TestResult, run_test};
use rstest::rstest;
#[rstest]
// avoid feeding strings containing parens to regex. Does not end well.
#[case(": arga help")]
#[case("argb help")]
#[case("optional, default: 20")]
#[case(": f1 switch")]
#[case(": f2 named no default")]
#[case(": f3 named default 3")]
#[c... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/tests.rs | tests/repl/tests.rs | use assert_cmd::prelude::*;
use pretty_assertions::assert_eq;
use std::collections::HashMap;
use std::io::Write;
use std::process::Command;
use tempfile::NamedTempFile;
pub type TestResult = Result<(), Box<dyn std::error::Error>>;
pub fn run_test_with_env(input: &str, expected: &str, env: &HashMap<&str, &str>) -> Tes... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_modules.rs | tests/repl/test_modules.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
use rstest::rstest;
#[test]
fn module_def_imports_1() -> TestResult {
run_test(
r#"module foo { export def a [] { 1 }; def b [] { 2 } }; use foo; foo a"#,
"1",
)
}
#[test]
fn module_def_imports_2() -> TestResult {
run_test(
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_config_path.rs | tests/repl/test_config_path.rs | use nu_path::{AbsolutePath, AbsolutePathBuf, Path};
use nu_test_support::nu;
use nu_test_support::playground::{Executable, Playground};
use pretty_assertions::assert_eq;
use std::fs::{self, File};
#[cfg(not(target_os = "windows"))]
fn adjust_canonicalization<P: AsRef<Path>>(p: P) -> String {
p.as_ref().display().t... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_hiding.rs | tests/repl/test_hiding.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
// TODO: Test the use/hide tests also as separate lines in REPL (i.e., with merging the delta in between)
#[test]
fn hides_def() -> TestResult {
fail_test(
r#"def myfoosymbol [] { "myfoosymbol" }; hide myfoosymbol; myfoosymbol"#,
"external... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_known_external.rs | tests/repl/test_known_external.rs | use crate::repl::tests::{TestResult, fail_test, run_test, run_test_contains};
use std::process::Command;
// cargo version prints a string of the form:
// cargo 1.60.0 (d1fd9fe2c 2022-03-01)
#[test]
fn known_external_runs() -> TestResult {
run_test_contains(r#"extern "cargo version" []; cargo version"#, "cargo")
}... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_env.rs | tests/repl/test_env.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
use nu_test_support::nu;
#[test]
fn shorthand_env_1() -> TestResult {
run_test(r#"FOO=BAZ $env.FOO"#, "BAZ")
}
#[test]
fn shorthand_env_2() -> TestResult {
fail_test(r#"FOO=BAZ FOO=MOO $env.FOO"#, "defined_twice")
}
#[test]
fn shorthand_env_3() -> Te... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_ranges.rs | tests/repl/test_ranges.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
use rstest::rstest;
#[test]
fn int_in_inc_range() -> TestResult {
run_test(r#"1 in -4..9.42"#, "true")
}
#[test]
fn int_in_dec_range() -> TestResult {
run_test(r#"1 in 9..-4.42"#, "true")
}
#[test]
fn int_in_exclusive_range() -> TestResult {
run_... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_iteration.rs | tests/repl/test_iteration.rs | use crate::repl::tests::{TestResult, run_test};
#[test]
fn better_block_types() -> TestResult {
run_test(
r#"([1, 2, 3] | enumerate | each { |e| $"($e.index) is ($e.item)" }).1"#,
"1 is 2",
)
}
#[test]
fn row_iteration() -> TestResult {
run_test(
"[[name, size]; [tj, 100], [rl, 200... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_regex.rs | tests/repl/test_regex.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
#[test]
fn contains() -> TestResult {
run_test(r#"'foobarbaz' =~ bar"#, "true")
}
#[test]
fn contains_case_insensitive() -> TestResult {
run_test(r#"'foobarbaz' =~ '(?i)BaR'"#, "true")
}
#[test]
fn not_contains() -> TestResult {
run_test(r#"'foob... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_parser.rs | tests/repl/test_parser.rs | use crate::repl::tests::{TestResult, fail_test, run_test, run_test_contains, run_test_with_env};
use nu_test_support::{nu, nu_repl_code};
use std::collections::HashMap;
#[test]
fn env_shorthand() -> TestResult {
run_test("FOO=BAR if false { 3 } else { 4 }", "4")
}
#[test]
fn subcommand() -> TestResult {
run_t... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/mod.rs | tests/repl/mod.rs | mod test_bits;
mod test_cell_path;
mod test_commandline;
mod test_conditionals;
mod test_config;
mod test_config_path;
mod test_converters;
mod test_custom_commands;
mod test_engine;
mod test_env;
mod test_help;
mod test_hiding;
mod test_ide;
mod test_iteration;
mod test_known_external;
mod test_math;
mod test_modules;... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_ide.rs | tests/repl/test_ide.rs | use crate::repl::tests::{TestResult, test_ide_contains};
#[test]
fn parser_recovers() -> TestResult {
test_ide_contains(
"3 + \"bob\"\nlet x = \"fred\"\n",
&["--ide-check 5"],
"\"typename\":\"string\"",
)
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_table_operations.rs | tests/repl/test_table_operations.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
#[test]
fn illegal_column_duplication() -> TestResult {
fail_test("[[lang, lang]; [nu, 100]]", "column_defined_twice")
}
#[test]
fn cell_path_subexpr1() -> TestResult {
run_test("([[lang, gems]; [nu, 100]]).lang | get 0", "nu")
}
#[test]
fn cell_path... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_spread.rs | tests/repl/test_spread.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
use nu_test_support::nu;
#[test]
fn spread_in_list() -> TestResult {
run_test(r#"[...[]] | to nuon"#, "[]").unwrap();
run_test(
r#"[1 2 ...[[3] {x: 1}] 5] | to nuon"#,
"[1, 2, [3], {x: 1}, 5]",
)
.unwrap();
run_test(
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_engine.rs | tests/repl/test_engine.rs | use crate::repl::tests::{TestResult, fail_test, run_test, run_test_contains};
use rstest::rstest;
#[test]
fn concrete_variable_assignment() -> TestResult {
run_test(
"let x = (1..100 | each { |y| $y + 100 }); let y = ($x | length); $x | length",
"100",
)
}
#[test]
fn proper_shadow() -> TestRes... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_config.rs | tests/repl/test_config.rs | use crate::repl::tests::{TestResult, fail_test, run_test, run_test_std};
#[test]
fn mutate_nu_config() -> TestResult {
run_test_std(
r#"$env.config.footer_mode = 30; $env.config.footer_mode"#,
"30",
)
}
#[test]
fn mutate_nu_config_nested_ls() -> TestResult {
run_test_std(
r#"$env.c... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_custom_commands.rs | tests/repl/test_custom_commands.rs | use crate::repl::tests::{TestResult, fail_test, run_test, run_test_contains};
use nu_test_support::nu;
use pretty_assertions::assert_eq;
use rstest::rstest;
#[test]
fn no_scope_leak1() -> TestResult {
fail_test(
"if false { let $x = 10 } else { let $x = 20 }; $x",
"Variable not found",
)
}
#[t... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_stdlib.rs | tests/repl/test_stdlib.rs | use crate::repl::tests::{TestResult, fail_test, run_test_std};
#[test]
fn not_loaded() -> TestResult {
fail_test("log info", "")
}
#[test]
fn use_command() -> TestResult {
run_test_std("use std/assert; assert true; print 'it works'", "it works")
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_bits.rs | tests/repl/test_bits.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
#[test]
fn bits_and() -> TestResult {
run_test("2 | bits and 4", "0")
}
#[test]
fn bits_and_negative() -> TestResult {
run_test("-3 | bits and 5", "5")
}
#[test]
fn bits_and_list() -> TestResult {
run_test("[1 2 3 8 9 10] | bits and 2 | str join ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_signatures.rs | tests/repl/test_signatures.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
use rstest::rstest;
#[test]
fn list_annotations() -> TestResult {
let input = "def run [list: list<int>] {$list | length}; run [2 5 4]";
let expected = "3";
run_test(input, expected)
}
#[test]
fn list_annotations_unknown_prefix() -> TestResult {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_conditionals.rs | tests/repl/test_conditionals.rs | use crate::repl::tests::{TestResult, run_test};
#[test]
fn if_test1() -> TestResult {
run_test("if true { 10 } else { 20 } ", "10")
}
#[test]
fn if_test2() -> TestResult {
run_test("if false { 10 } else { 20 } ", "20")
}
#[test]
fn simple_if() -> TestResult {
run_test("if true { 10 } ", "10")
}
#[test]
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_strings.rs | tests/repl/test_strings.rs | use crate::repl::tests::{TestResult, fail_test, run_test};
#[test]
fn cjk_in_substrings() -> TestResult {
run_test(
r#"let s = '[Rust 程序设计语言](title-page.md)'; let start = ($s | str index-of '('); let end = ($s | str index-of ')'); $s | str substring ($start + 1)..<($end)"#,
"title-page.md",
)
}... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/repl/test_type_check.rs | tests/repl/test_type_check.rs | use crate::repl::tests::{TestResult, fail_test, run_test, run_test_contains};
use rstest::rstest;
#[test]
fn chained_operator_typecheck() -> TestResult {
run_test("1 != 2 and 3 != 4 and 5 != 6", "true")
}
#[test]
fn type_in_list_of_this_type() -> TestResult {
run_test(r#"42 in [41 42 43]"#, "true")
}
#[test]... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/parsing/mod.rs | tests/parsing/mod.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
use rstest::rstest;
#[test]
fn source_file_relative_to_file() {
let actual = nu!(cwd: "tests/parsing/samples", "
nu source_file_relative.nu
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugin_persistence/mod.rs | tests/plugin_persistence/mod.rs | //! The tests in this file check the soundness of plugin persistence. When a plugin is needed by Nu,
//! it is spawned only if it was not already running. Plugins that are spawned are kept running and
//! are referenced in the engine state. Plugins can be stopped by the user if desired, but not
//! removed.
use nu_tes... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/hooks/mod.rs | tests/hooks/mod.rs | use nu_test_support::{nu, nu_repl_code};
use pretty_assertions::assert_eq;
fn env_change_hook_code_list(name: &str, code_list: &[&str]) -> String {
let mut list = String::new();
for code in code_list.iter() {
list.push_str("{ code: ");
list.push_str(code);
list.push_str(" }\n");
}
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/overlays/mod.rs | tests/overlays/mod.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code};
use pretty_assertions::assert_eq;
#[test]
fn add_overlay() {
let inp = &[
r#"module spam { export def foo [] { "foo" } }"#,
"overlay us... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | true |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/config.rs | tests/plugins/config.rs | use nu_test_support::nu_with_plugins;
#[test]
fn none() {
let actual = nu_with_plugins!(
cwd: "tests",
plugin: ("nu_plugin_example"),
"example config"
);
assert!(actual.err.contains("No config sent"));
}
#[test]
fn some() {
let actual = nu_with_plugins!(
cwd: "tests",
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/stream.rs | tests/plugins/stream.rs | use rstest::rstest;
use nu_test_support::nu_with_plugins;
use pretty_assertions::assert_eq;
#[test]
fn seq_produces_stream() {
let actual = nu_with_plugins!(
cwd: "tests/fixtures/formats",
plugin: ("nu_plugin_example"),
"example seq 1 5 | describe"
);
assert_eq!(actual.out, "list<... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/core_inc.rs | tests/plugins/core_inc.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn chooses_highest_increment_if_given_more_than_one() {
let actual = nu_with_plugins!(
cwd: "tests/fixtures/formats",
plugin: ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/register.rs | tests/plugins/register.rs | use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
#[test]
fn help() {
Playground::setup("help", |dirs, _| {
let actual = nu_with_plugins!(
cwd: dirs.test(),
plugin: ("nu_plugin_example"),
"example one --help"
);
assert!(actua... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/custom_values.rs | tests/plugins/custom_values.rs | use nu_test_support::{nu_with_plugins, playground::Playground};
use pretty_assertions::assert_eq;
#[test]
fn can_get_custom_value_from_plugin_and_instantly_collapse_it() {
let actual = nu_with_plugins!(
cwd: "tests",
plugin: ("nu_plugin_custom_values"),
"custom-value generate"
);
a... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/env.rs | tests/plugins/env.rs | use nu_test_support::nu_with_plugins;
#[test]
fn get_env_by_name() {
let result = nu_with_plugins!(
cwd: ".",
plugin: ("nu_plugin_example"),
r#"
$env.FOO = 'bar'
example env FOO | print
$env.FOO = 'baz'
example env FOO | print
"#
)... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/nu_plugin_nu_example.rs | tests/plugins/nu_plugin_nu_example.rs | use assert_cmd::Command;
#[test]
fn call() {
// Add the `nu` binaries to the path env
let path_env = std::env::join_paths(
std::iter::once(nu_test_support::fs::binaries().into()).chain(
std::env::var_os(nu_test_support::NATIVE_PATH_ENV_VAR)
.as_deref()
.map(s... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/mod.rs | tests/plugins/mod.rs | mod call_decl;
mod config;
mod core_inc;
mod custom_values;
mod env;
mod formats;
mod nu_plugin_nu_example;
mod register;
mod registry_file;
mod stream;
mod stress_internals;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/stress_internals.rs | tests/plugins/stress_internals.rs | use std::{sync::mpsc, time::Duration};
use nu_test_support::nu_with_plugins;
fn ensure_stress_env_vars_unset() {
for (key, _) in std::env::vars_os() {
if key.to_string_lossy().starts_with("STRESS_") {
panic!("Test is running in a dirty environment: {key:?} is set");
}
}
}
#[test]
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/call_decl.rs | tests/plugins/call_decl.rs | use nu_test_support::nu_with_plugins;
#[test]
fn call_to_json() {
let result = nu_with_plugins!(
cwd: ".",
plugin: ("nu_plugin_example"),
r#"
[42] | example call-decl 'to json' {indent: 4}
"#
);
assert!(result.status.success());
// newlines are removed from t... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/registry_file.rs | tests/plugins/registry_file.rs | use std::{fs::File, path::PathBuf};
use nu_protocol::{PluginRegistryFile, PluginRegistryItem, PluginRegistryItemData};
use nu_test_support::{fs::Stub, nu, nu_with_plugins, playground::Playground};
fn example_plugin_path() -> PathBuf {
nu_test_support::commands::ensure_plugins_built();
let bins_path = nu_test... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/formats/vcf.rs | tests/plugins/formats/vcf.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn infers_types() {
Playground::setup("filter_from_vcf_test_1", |dirs, sandbox| {
sandbox.with_files(&[F... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/formats/ics.rs | tests/plugins/formats/ics.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn infers_types() {
Playground::setup("filter_from_ics_test_1", |dirs, sandbox| {
sandbox.with_files(&[F... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/formats/ini.rs | tests/plugins/formats/ini.rs | use nu_test_support::fs::Stub::FileWithContentToBeTrimmed;
use nu_test_support::nu_with_plugins;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
const TEST_CWD: &str = "tests/fixtures/formats";
#[test]
fn parses_ini() {
let actual = nu_with_plugins!(
cwd: TEST_CWD,
p... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/formats/mod.rs | tests/plugins/formats/mod.rs | mod eml;
mod ics;
mod ini;
mod vcf;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/plugins/formats/eml.rs | tests/plugins/formats/eml.rs | use nu_test_support::nu_with_plugins;
use pretty_assertions::assert_eq;
const TEST_CWD: &str = "tests/fixtures/formats";
// Note: the tests can only run successfully if nushell binary is in `target/debug/`
// The To field in this email is just "to@example.com", which gets parsed out as the Address. The Name is empty.... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/eval/mod.rs | tests/eval/mod.rs | use fancy_regex::Regex;
use nu_test_support::{nu, playground::Playground};
#[test]
fn record_with_redefined_key() {
let actual = nu!("{x: 1, x: 2}");
assert!(actual.err.contains("redefined"));
}
#[test]
fn run_file_parse_error() {
let actual = nu!(
cwd: "tests/fixtures/eval",
"nu script.n... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/modules/mod.rs | tests/modules/mod.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code};
use pretty_assertions::assert_eq;
use rstest::rstest;
#[test]
fn module_private_import_decl() {
Playground::setup("module_private_import_decl", |dirs, ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/const_/mod.rs | tests/const_/mod.rs | use nu_test_support::nu;
use pretty_assertions::assert_eq;
use rstest::rstest;
const MODULE_SETUP: &str = r#"
module spam {
export const X = 'x'
export module eggs {
export const E = 'e'
export module bacon {
export const viking = 'eats'
expor... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/path/expand_path.rs | tests/path/expand_path.rs | use nu_path::expand_path_with;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
use std::path::PathBuf;
#[cfg(not(windows))]
#[test]
fn expand_path_with_and_without_relative() {
let relative_to = "/foo/bar";
let path = "../..";
let full_path = "/foo/bar/../..";
let cwd = ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/path/canonicalize.rs | tests/path/canonicalize.rs | use nu_path::canonicalize_with;
use nu_test_support::fs::Stub::EmptyFile;
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
use std::path::Path;
#[test]
fn canonicalize_path() {
Playground::setup("nu_path_test_1", |dirs, sandbox| {
sandbox.with_files(&[... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/path/mod.rs | tests/path/mod.rs | mod canonicalize;
mod expand_path;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/repl.rs | tests/shell/repl.rs | use nu_test_support::{nu, nu_repl_code};
use pretty_assertions::assert_eq;
#[test]
fn mut_variable() {
let lines = &["mut x = 0", "$x = 1", "$x"];
let actual = nu!(nu_repl_code(lines));
assert_eq!(actual.out, "1");
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/mod.rs | tests/shell/mod.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code};
use pretty_assertions::assert_eq;
mod environment;
mod pipeline;
mod repl;
//FIXME: jt: we need to focus some fixes on wix as the plugins will differ
#[ig... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/environment/env.rs | tests/shell/environment/env.rs | use nu_test_support::fs::Stub::FileWithContent;
use nu_test_support::playground::Playground;
use nu_test_support::{nu, nu_repl_code, nu_with_std};
use pretty_assertions::assert_eq;
#[test]
fn env_shorthand() {
let actual = nu!("
FOO=bar echo $env.FOO
");
assert_eq!(actual.out, "bar");
}
#[test... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/environment/mod.rs | tests/shell/environment/mod.rs | mod env;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/pipeline/mod.rs | tests/shell/pipeline/mod.rs | mod commands;
use nu_test_support::nu;
use pretty_assertions::assert_eq;
#[test]
fn doesnt_break_on_utf8() {
let actual = nu!("echo ö");
assert_eq!(actual.out, "ö", "'{}' should contain ö", actual.out);
}
#[test]
fn non_zero_exit_code_in_middle_of_pipeline_ignored() {
let actual = nu!("nu -c 'print a b; ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/pipeline/commands/external.rs | tests/shell/pipeline/commands/external.rs | use nu_test_support::fs::Stub::{EmptyFile, FileWithContent};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
use rstest::rstest;
#[test]
fn shows_error_for_command_not_found() {
let actual = nu!("ferris_is_not_here.exe");
assert!(!actual.err.is_empty());... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/pipeline/commands/internal.rs | tests/shell/pipeline/commands/internal.rs | use nu_test_support::fs::Stub::{FileWithContent, FileWithContentToBeTrimmed};
use nu_test_support::nu;
use nu_test_support::playground::Playground;
use pretty_assertions::assert_eq;
#[test]
fn takes_rows_of_nu_value_strings_and_pipes_it_to_stdin_of_external() {
let actual = nu!(r###"
[
[name ru... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/tests/shell/pipeline/commands/mod.rs | tests/shell/pipeline/commands/mod.rs | mod external;
mod internal;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/benches/benchmarks.rs | benches/benchmarks.rs | use nu_cli::{eval_source, evaluate_commands};
use nu_plugin_core::{Encoder, EncodingType};
use nu_plugin_protocol::{PluginCallResponse, PluginOutput};
use nu_protocol::{
PipelineData, Signals, Span, Spanned, Value,
engine::{EngineState, Stack},
};
use nu_std::load_standard_library;
use nu_utils::ConfigFileKind;... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/query_web.rs | crates/nu_plugin_query/src/query_web.rs | use crate::{Query, web_tables::WebTable};
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
use nu_protocol::{
Category, Example, LabeledError, Record, Signature, Span, Spanned, SyntaxShape, Value,
};
use scraper::{Html, Selector as ScraperSelector};
pub struct QueryWeb;
impl SimplePluginComma... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/lib.rs | crates/nu_plugin_query/src/lib.rs | mod query;
mod query_json;
mod query_web;
mod query_webpage_info;
mod query_xml;
mod web_tables;
pub use query::Query;
pub use query_json::{QueryJson, execute_json_query};
pub use query_web::{QueryWeb, parse_selector_params};
pub use query_xml::{QueryXml, execute_xpath_query};
pub use web_tables::WebTable;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/query_xml.rs | crates/nu_plugin_query/src/query_xml.rs | use crate::Query;
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
use nu_protocol::{
Category, Example, LabeledError, Record, Signature, Span, Spanned, SyntaxShape, Type, Value,
record,
};
use sxd_document::parser;
use sxd_xpath::{Context, Factory};
pub struct QueryXml;
impl SimplePlugin... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/query_json.rs | crates/nu_plugin_query/src/query_json.rs | use crate::Query;
use gjson::Value as gjValue;
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
use nu_protocol::{
Category, Example, LabeledError, Record, Signature, Span, Spanned, SyntaxShape, Value,
};
pub struct QueryJson;
impl SimplePluginCommand for QueryJson {
type Plugin = Query;
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/web_tables.rs | crates/nu_plugin_query/src/web_tables.rs | use crate::query_web::css;
use scraper::{Html, Selector as ScraperSelector, element_ref::ElementRef};
use std::collections::HashMap;
pub type Headers = HashMap<String, usize>;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct WebTable {
headers: Headers,
pub data: Vec<Vec<String>>,
}
impl WebTable {
/// ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | true |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/query.rs | crates/nu_plugin_query/src/query.rs | use crate::{
query_json::QueryJson, query_web::QueryWeb, query_webpage_info::QueryWebpageInfo,
query_xml::QueryXml,
};
use nu_plugin::{EvaluatedCall, Plugin, PluginCommand, SimplePluginCommand};
use nu_protocol::{Category, LabeledError, Signature, Value};
#[derive(Default)]
pub struct Query;
impl Query {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/main.rs | crates/nu_plugin_query/src/main.rs | use nu_plugin::{JsonSerializer, serve_plugin};
use nu_plugin_query::Query;
fn main() {
serve_plugin(&Query {}, JsonSerializer {})
}
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu_plugin_query/src/query_webpage_info.rs | crates/nu_plugin_query/src/query_webpage_info.rs | use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
use nu_protocol::{Category, Example, LabeledError, Record, Signature, Span, Type, Value};
use crate::Query;
pub struct QueryWebpageInfo;
impl SimplePluginCommand for QueryWebpageInfo {
type Plugin = Query;
fn name(&self) -> &str {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/color_config.rs | crates/nu-color-config/src/color_config.rs | use crate::{
NuStyle,
nu_style::{color_from_hex, lookup_style},
parse_nustyle,
};
use nu_ansi_term::Style;
use nu_protocol::{Record, Value};
use std::collections::HashMap;
pub fn lookup_ansi_color_style(s: &str) -> Style {
if s.starts_with('#') {
color_from_hex(s)
.ok()
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/nu_style.rs | crates/nu-color-config/src/nu_style.rs | use nu_ansi_term::{Color, Style};
use nu_protocol::Value;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, PartialEq, Eq, Debug)]
pub struct NuStyle {
pub fg: Option<String>,
pub bg: Option<String>,
pub attr: Option<String>,
}
impl From<Style> for NuStyle {
fn from(s: Style) -> Se... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | true |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/lib.rs | crates/nu-color-config/src/lib.rs | #![doc = include_str!("../README.md")]
mod color_config;
mod matching_brackets_style;
mod nu_style;
mod shape_color;
mod style_computer;
mod text_style;
pub use color_config::*;
pub use matching_brackets_style::*;
pub use nu_style::*;
pub use shape_color::*;
pub use style_computer::*;
pub use text_style::*;
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/matching_brackets_style.rs | crates/nu-color-config/src/matching_brackets_style.rs | use crate::color_config::lookup_ansi_color_style;
use nu_ansi_term::Style;
use nu_protocol::Config;
pub fn get_matching_brackets_style(default_style: Style, conf: &Config) -> Style {
const MATCHING_BRACKETS_CONFIG_KEY: &str = "shape_matching_brackets";
match conf.color_config.get(MATCHING_BRACKETS_CONFIG_KEY)... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/style_computer.rs | crates/nu-color-config/src/style_computer.rs | use crate::{TextStyle, color_record_to_nustyle, lookup_ansi_color_style, text_style::Alignment};
use nu_ansi_term::{Color, Style};
use nu_engine::ClosureEvalOnce;
use nu_protocol::{
Span, Value,
engine::{Closure, EngineState, Stack},
report_shell_error,
};
use std::{
collections::HashMap,
fmt::{Debu... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/text_style.rs | crates/nu-color-config/src/text_style.rs | use nu_ansi_term::{Color, Style};
#[derive(Debug, Clone, Copy)]
pub enum Alignment {
Center,
Left,
Right,
}
#[derive(Debug, Clone, Copy)]
pub struct TextStyle {
pub alignment: Alignment,
pub color_style: Option<Style>,
}
impl TextStyle {
pub fn new() -> TextStyle {
TextStyle {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-color-config/src/shape_color.rs | crates/nu-color-config/src/shape_color.rs | use crate::{color_config::lookup_ansi_color_style, color_record_to_nustyle};
use nu_ansi_term::{Color, Style};
use nu_protocol::{Config, Value};
// The default colors for shapes, used when there is no config for them.
pub fn default_shape_color(shape: &str) -> Style {
match shape {
"shape_binary" => Style:... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-pretty-hex/src/lib.rs | crates/nu-pretty-hex/src/lib.rs | //! A Rust library providing pretty hex dump.
//!
//! A `simple_hex()` way renders one-line hex dump, and a `pretty_hex()` way renders
//! columned multi-line hex dump with addressing and ASCII representation.
//! A `config_hex()` way renders hex dump in specified format.
//!
//! ## Example of `simple_hex()`
//! ```
//... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-pretty-hex/src/pretty_hex.rs | crates/nu-pretty-hex/src/pretty_hex.rs | use core::fmt;
use nu_ansi_term::{Color, Style};
/// Returns a one-line hexdump of `source` grouped in default format without header
/// and ASCII column.
pub fn simple_hex<T: AsRef<[u8]>>(source: &T) -> String {
let mut writer = String::new();
hex_write(&mut writer, source, HexConfig::simple(), None).unwrap_o... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-pretty-hex/tests/tests.rs | crates/nu-pretty-hex/tests/tests.rs | use nu_pretty_hex::*;
// #[test]
// fn test_simple() {
// let bytes: Vec<u8> = (0..16).collect();
// let expected = "00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f";
// assert_eq!(expected, simple_hex(&bytes));
// assert_eq!(expected, bytes.hex_dump().to_string());
// assert_eq!(simple_hex(&byt... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-pretty-hex/examples/hex_demo.rs | crates/nu-pretty-hex/examples/hex_demo.rs | use nu_pretty_hex::*;
fn main() {
let config = HexConfig {
title: true,
ascii: true,
width: 16,
group: 4,
chunk: 1,
address_offset: 0,
skip: Some(10),
// length: Some(5),
// length: None,
length: Some(50),
};
let my_string = "... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/locale_override.rs | crates/nu-test-support/src/locale_override.rs | #![cfg(debug_assertions)]
use std::sync::Mutex;
use nu_utils::locale::LOCALE_OVERRIDE_ENV_VAR;
static LOCALE_OVERRIDE_MUTEX: Mutex<()> = Mutex::new(());
/// Run a closure in a fake locale environment.
///
/// Before the closure is executed, an environment variable whose name is
/// defined in `nu_utils::locale::LOC... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/lib.rs | crates/nu-test-support/src/lib.rs | #![doc = include_str!("../README.md")]
pub mod commands;
pub mod fs;
pub mod locale_override;
pub mod macros;
pub mod playground;
use std::process::ExitStatus;
// Needs to be reexported for `nu!` macro
pub use nu_path;
#[derive(Debug)]
pub struct Outcome {
pub out: String,
pub err: String,
pub status: Exi... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/fs.rs | crates/nu-test-support/src/fs.rs | use nu_path::{AbsolutePath, AbsolutePathBuf, Path};
use std::io::Read;
pub enum Stub<'a> {
FileWithContent(&'a str, &'a str),
FileWithContentToBeTrimmed(&'a str, &'a str),
EmptyFile(&'a str),
FileWithPermission(&'a str, bool),
}
pub fn file_contents(full_path: impl AsRef<AbsolutePath>) -> String {
... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/playground.rs | crates/nu-test-support/src/playground.rs | mod director;
pub mod nu_process;
mod play;
#[cfg(test)]
mod tests;
pub use director::Director;
pub use nu_process::{Executable, NuProcess, Outcome};
pub use play::{Dirs, EnvironmentVariable, Playground};
| rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/macros.rs | crates/nu-test-support/src/macros.rs | /// Run a command in nu and get its output
///
/// The `nu!` macro accepts a number of options like the `cwd` in which the
/// command should be run. It is also possible to specify a different `locale`
/// to test locale dependent commands.
///
/// Pass options as the first arguments in the form of `key_1: value_1, key... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/commands.rs | crates/nu-test-support/src/commands.rs | use std::{
io::Read,
process::{Command, Stdio},
sync::{
Mutex,
atomic::{AtomicBool, Ordering::Relaxed},
},
};
static CARGO_BUILD_LOCK: Mutex<()> = Mutex::new(());
static PLUGINS_BUILT: AtomicBool = AtomicBool::new(false);
// This runs `cargo build --package nu_plugin_*` to ensure that ... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/playground/play.rs | crates/nu-test-support/src/playground/play.rs | use super::Director;
use crate::fs::{self, Stub};
use nu_glob::{Uninterruptible, glob};
#[cfg(not(target_arch = "wasm32"))]
use nu_path::Path;
use nu_path::{AbsolutePath, AbsolutePathBuf};
use std::str;
use tempfile::{TempDir, tempdir};
#[derive(Default, Clone, Debug)]
pub struct EnvironmentVariable {
pub name: St... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/playground/tests.rs | crates/nu-test-support/src/playground/tests.rs | use crate::playground::Playground;
#[test]
fn current_working_directory_in_sandbox_directory_created() {
Playground::setup("topic", |dirs, nu| {
let original_cwd = dirs.test();
nu.within("some_directory_within");
assert_eq!(nu.cwd(), original_cwd.join("some_directory_within"));
})
}
#... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
nushell/nushell | https://github.com/nushell/nushell/blob/6d3cb27fa40b324a1168c577aee7f3532a5e157e/crates/nu-test-support/src/playground/director.rs | crates/nu-test-support/src/playground/director.rs | use super::EnvironmentVariable;
use super::nu_process::*;
use std::ffi::OsString;
use std::fmt;
use std::fmt::Write;
#[derive(Default, Debug)]
pub struct Director {
pub cwd: Option<OsString>,
pub environment_vars: Vec<EnvironmentVariable>,
pub config: Option<OsString>,
pub pipeline: Option<Vec<String>>... | rust | MIT | 6d3cb27fa40b324a1168c577aee7f3532a5e157e | 2026-01-04T15:32:17.606688Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.