mirror of
https://github.com/nushell/nushell
synced 2024-12-27 05:23:11 +00:00
use simpler reedline (#6016)
This commit is contained in:
parent
c1bf9fd897
commit
a5470b2362
8 changed files with 6 additions and 20 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -3851,8 +3851,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "reedline"
|
name = "reedline"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "git+https://github.com/nushell/reedline.git#59f7144d721cd573f629048e753f163f2652334f"
|
||||||
checksum = "d064ec92a21deb048c440b6461ccf0d0babdb5f2160ea9dfac451bc7b4b556e2"
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono",
|
"chrono",
|
||||||
"crossterm",
|
"crossterm",
|
||||||
|
|
|
@ -52,7 +52,7 @@ nu-system = { path = "./crates/nu-system", version = "0.65.1" }
|
||||||
nu-table = { path = "./crates/nu-table", version = "0.65.1" }
|
nu-table = { path = "./crates/nu-table", version = "0.65.1" }
|
||||||
nu-term-grid = { path = "./crates/nu-term-grid", version = "0.65.1" }
|
nu-term-grid = { path = "./crates/nu-term-grid", version = "0.65.1" }
|
||||||
nu-utils = { path = "./crates/nu-utils", version = "0.65.1" }
|
nu-utils = { path = "./crates/nu-utils", version = "0.65.1" }
|
||||||
reedline = { version = "0.8.0", features = ["bashisms", "sqlite"]}
|
reedline = { git = "https://github.com/nushell/reedline.git", features = ["bashisms", "sqlite"]}
|
||||||
pretty_env_logger = "0.4.0"
|
pretty_env_logger = "0.4.0"
|
||||||
rayon = "1.5.1"
|
rayon = "1.5.1"
|
||||||
is_executable = "1.0.1"
|
is_executable = "1.0.1"
|
||||||
|
|
|
@ -18,7 +18,7 @@ nu-protocol = { path = "../nu-protocol", version = "0.65.1" }
|
||||||
nu-utils = { path = "../nu-utils", version = "0.65.1" }
|
nu-utils = { path = "../nu-utils", version = "0.65.1" }
|
||||||
nu-ansi-term = "0.46.0"
|
nu-ansi-term = "0.46.0"
|
||||||
nu-color-config = { path = "../nu-color-config", version = "0.65.1" }
|
nu-color-config = { path = "../nu-color-config", version = "0.65.1" }
|
||||||
reedline = { version = "0.8.0", features = ["bashisms", "sqlite"]}
|
reedline = { git = "https://github.com/nushell/reedline.git", features = ["bashisms", "sqlite"]}
|
||||||
crossterm = "0.23.0"
|
crossterm = "0.23.0"
|
||||||
miette = { version = "5.1.0", features = ["fancy"] }
|
miette = { version = "5.1.0", features = ["fancy"] }
|
||||||
thiserror = "1.0.31"
|
thiserror = "1.0.31"
|
||||||
|
|
|
@ -148,7 +148,6 @@ pub fn evaluate_repl(
|
||||||
engine_state: engine_state.clone(),
|
engine_state: engine_state.clone(),
|
||||||
config: config.clone(),
|
config: config.clone(),
|
||||||
}))
|
}))
|
||||||
.with_animation(config.animate_prompt)
|
|
||||||
.with_validator(Box::new(NuValidator {
|
.with_validator(Box::new(NuValidator {
|
||||||
engine_state: engine_state.clone(),
|
engine_state: engine_state.clone(),
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -84,7 +84,7 @@ unicode-segmentation = "1.8.0"
|
||||||
url = "2.2.1"
|
url = "2.2.1"
|
||||||
uuid = { version = "1.1.2", features = ["v4"] }
|
uuid = { version = "1.1.2", features = ["v4"] }
|
||||||
which = { version = "4.2.2", optional = true }
|
which = { version = "4.2.2", optional = true }
|
||||||
reedline = { version = "0.8.0", features = ["bashisms", "sqlite"]}
|
reedline = { git = "https://github.com/nushell/reedline.git", features = ["bashisms", "sqlite"]}
|
||||||
wax = { version = "0.5.0", features = ["diagnostics"] }
|
wax = { version = "0.5.0", features = ["diagnostics"] }
|
||||||
rusqlite = { version = "0.27.0", features = ["bundled"], optional = true }
|
rusqlite = { version = "0.27.0", features = ["bundled"], optional = true }
|
||||||
sqlparser = { version = "0.16.0", features = ["serde"], optional = true }
|
sqlparser = { version = "0.16.0", features = ["serde"], optional = true }
|
||||||
|
|
|
@ -2,8 +2,6 @@ use crate::{ShellError, Span, Value};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
const ANIMATE_PROMPT_DEFAULT: bool = true;
|
|
||||||
|
|
||||||
/// Definition of a parsed keybinding from the config object
|
/// Definition of a parsed keybinding from the config object
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
pub struct ParsedKeybinding {
|
pub struct ParsedKeybinding {
|
||||||
|
@ -56,7 +54,6 @@ pub struct Config {
|
||||||
pub color_config: HashMap<String, Value>,
|
pub color_config: HashMap<String, Value>,
|
||||||
pub use_grid_icons: bool,
|
pub use_grid_icons: bool,
|
||||||
pub footer_mode: FooterMode,
|
pub footer_mode: FooterMode,
|
||||||
pub animate_prompt: bool,
|
|
||||||
pub float_precision: i64,
|
pub float_precision: i64,
|
||||||
pub filesize_format: String,
|
pub filesize_format: String,
|
||||||
pub use_ansi_coloring: bool,
|
pub use_ansi_coloring: bool,
|
||||||
|
@ -89,7 +86,6 @@ impl Default for Config {
|
||||||
color_config: HashMap::new(),
|
color_config: HashMap::new(),
|
||||||
use_grid_icons: false,
|
use_grid_icons: false,
|
||||||
footer_mode: FooterMode::RowCount(25),
|
footer_mode: FooterMode::RowCount(25),
|
||||||
animate_prompt: ANIMATE_PROMPT_DEFAULT,
|
|
||||||
float_precision: 4,
|
float_precision: 4,
|
||||||
filesize_format: "auto".into(),
|
filesize_format: "auto".into(),
|
||||||
use_ansi_coloring: true,
|
use_ansi_coloring: true,
|
||||||
|
@ -195,13 +191,6 @@ impl Value {
|
||||||
eprintln!("$config.footer_mode is not a string")
|
eprintln!("$config.footer_mode is not a string")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"animate_prompt" => {
|
|
||||||
if let Ok(b) = value.as_bool() {
|
|
||||||
config.animate_prompt = b;
|
|
||||||
} else {
|
|
||||||
eprintln!("$config.animate_prompt is not a bool")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
"float_precision" => {
|
"float_precision" => {
|
||||||
if let Ok(i) = value.as_integer() {
|
if let Ok(i) = value.as_integer() {
|
||||||
config.float_precision = i;
|
config.float_precision = i;
|
||||||
|
|
|
@ -243,7 +243,6 @@ let-env config = {
|
||||||
quick_completions: true # set this to false to prevent auto-selecting completions when only one remains
|
quick_completions: true # set this to false to prevent auto-selecting completions when only one remains
|
||||||
partial_completions: true # set this to false to prevent partial filling of the prompt
|
partial_completions: true # set this to false to prevent partial filling of the prompt
|
||||||
completion_algorithm: "prefix" # prefix, fuzzy
|
completion_algorithm: "prefix" # prefix, fuzzy
|
||||||
animate_prompt: false # redraw the prompt every second
|
|
||||||
float_precision: 2
|
float_precision: 2
|
||||||
# buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
|
# buffer_editor: "emacs" # command that will be used to edit the current line buffer with ctrl+o, if unset fallback to $env.EDITOR and $env.VISUAL
|
||||||
use_ansi_coloring: true
|
use_ansi_coloring: true
|
||||||
|
|
|
@ -11,9 +11,9 @@ fn outcome_err(
|
||||||
engine_state: &EngineState,
|
engine_state: &EngineState,
|
||||||
error: &(dyn miette::Diagnostic + Send + Sync + 'static),
|
error: &(dyn miette::Diagnostic + Send + Sync + 'static),
|
||||||
) -> Outcome {
|
) -> Outcome {
|
||||||
let working_set = StateWorkingSet::new(&engine_state);
|
let working_set = StateWorkingSet::new(engine_state);
|
||||||
|
|
||||||
eprintln!("{}", format!("Error: {:?}", CliError(error, &working_set)));
|
eprintln!("Error: {:?}", CliError(error, &working_set));
|
||||||
|
|
||||||
Outcome {
|
Outcome {
|
||||||
out: String::new(),
|
out: String::new(),
|
||||||
|
|
Loading…
Reference in a new issue