This commit is contained in:
Joseph T. Lyons 2021-01-01 23:24:32 -05:00 committed by GitHub
parent 7eb8634ad7
commit a5f7600f6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 37 additions and 37 deletions

View File

@ -122,7 +122,7 @@ async fn benchmark(raw_args: CommandArgs) -> Result<OutputStream, ShellError> {
benchmark_output(indexmap, output, passthrough, &tag, &mut context).await benchmark_output(indexmap, output, passthrough, &tag, &mut context).await
} else { } else {
Err(ShellError::untagged_runtime_error( Err(ShellError::untagged_runtime_error(
"Could not retreive CPU time", "Could not retrieve CPU time",
)) ))
} }
} }

View File

@ -73,7 +73,7 @@ async fn process_row(
match replace_for { match replace_for {
Ok(s) => match convert_bytes_to_string_using_format(s, format) { Ok(s) => match convert_bytes_to_string_using_format(s, format) {
Ok(b) => OutputStream::one(ReturnSuccess::value( Ok(b) => OutputStream::one(ReturnSuccess::value(
input.replace_data_at_column_path(&field, b).expect("Given that the existance check was already done, this souldn't trigger never"), input.replace_data_at_column_path(&field, b).expect("Given that the existence check was already done, this shouldn't trigger never"),
)), )),
Err(e) => OutputStream::one(Err(e)), Err(e) => OutputStream::one(Err(e)),
}, },

View File

@ -90,7 +90,7 @@ pub async fn histogram(args: CommandArgs) -> Result<OutputStream, ShellError> {
} else if let Some((key, _)) = columns[0].split_last() { } else if let Some((key, _)) = columns[0].split_last() {
key.as_string() key.as_string()
} else { } else {
"frecuency".to_string() "frequency".to_string()
}; };
let column = if let Some(ref column) = column_grouper { let column = if let Some(ref column) = column_grouper {
@ -149,7 +149,7 @@ pub async fn histogram(args: CommandArgs) -> Result<OutputStream, ShellError> {
.ok_or_else(|| { .ok_or_else(|| {
ShellError::labeled_error( ShellError::labeled_error(
"Unable to load group labels", "Unable to load group labels",
"unabled to load group labels", "unable to load group labels",
&name, &name,
) )
})? })?

View File

@ -14,7 +14,7 @@ impl WholeStreamCommand for SubCommand {
} }
fn signature(&self) -> Signature { fn signature(&self) -> Signature {
Signature::build("math celi") Signature::build("math ceil")
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -120,7 +120,7 @@ pub fn compute_stddev(values: &[Value], n: usize, name: &Tag) -> Result<Value, S
_ => { _ => {
return Err(ShellError::labeled_error( return Err(ShellError::labeled_error(
"Could not take square root of variance", "Could not take square root of variance",
"error occured here", "error occurred here",
name.span, name.span,
)) ))
} }
@ -129,7 +129,7 @@ pub fn compute_stddev(values: &[Value], n: usize, name: &Tag) -> Result<Value, S
Some(stddev) => Ok(UntaggedValue::from(Primitive::Decimal(stddev)).into_value(name)), Some(stddev) => Ok(UntaggedValue::from(Primitive::Decimal(stddev)).into_value(name)),
None => Err(ShellError::labeled_error( None => Err(ShellError::labeled_error(
"Could not calculate stddev", "Could not calculate stddev",
"error occured here", "error occurred here",
name.span, name.span,
)), )),
} }

View File

@ -33,7 +33,7 @@ impl WholeStreamCommand for SubCommand {
SyntaxShape::ColumnPath, SyntaxShape::ColumnPath,
"optionally find and replace text by column paths", "optionally find and replace text by column paths",
) )
.switch("all", "replace all occurences of find string", Some('a')) .switch("all", "replace all occurrences of find string", Some('a'))
} }
fn usage(&self) -> &str { fn usage(&self) -> &str {

View File

@ -80,7 +80,7 @@ impl Scope {
} }
pub fn get_vars(&self) -> IndexMap<String, Value> { pub fn get_vars(&self) -> IndexMap<String, Value> {
//FIXME: should this be an interator? //FIXME: should this be an iterator?
let mut output = IndexMap::new(); let mut output = IndexMap::new();
for frame in self.frames.lock().iter().rev() { for frame in self.frames.lock().iter().rev() {
@ -93,7 +93,7 @@ impl Scope {
} }
pub fn get_env_vars(&self) -> IndexMap<String, String> { pub fn get_env_vars(&self) -> IndexMap<String, String> {
//FIXME: should this be an interator? //FIXME: should this be an iterator?
let mut output = IndexMap::new(); let mut output = IndexMap::new();
for frame in self.frames.lock().iter().rev() { for frame in self.frames.lock().iter().rev() {
@ -242,7 +242,7 @@ impl ScopeFrame {
// impl Scope { // impl Scope {
// pub fn vars(&self) -> IndexMap<String, Value> { // pub fn vars(&self) -> IndexMap<String, Value> {
// //FIXME: should this be an interator? // //FIXME: should this be an iterator?
// let mut output = IndexMap::new(); // let mut output = IndexMap::new();
@ -262,7 +262,7 @@ impl ScopeFrame {
// } // }
// pub fn env(&self) -> IndexMap<String, String> { // pub fn env(&self) -> IndexMap<String, String> {
// //FIXME: should this be an interator? // //FIXME: should this be an iterator?
// let mut output = IndexMap::new(); // let mut output = IndexMap::new();

View File

@ -89,8 +89,8 @@ pub async fn process_script(
let name = args let name = args
.positional .positional
.as_ref() .as_ref()
.and_then(|potionals| { .and_then(|positionals| {
potionals.get(0).map(|e| { positionals.get(0).map(|e| {
if let Expression::Literal(Literal::String(ref s)) = e.expr { if let Expression::Literal(Literal::String(ref s)) = e.expr {
&s &s
} else { } else {

View File

@ -265,7 +265,7 @@ impl ThemeColor {
match character { match character {
b'0'..=b'9' => Ok(character - b'0'), b'0'..=b'9' => Ok(character - b'0'),
b'a'..=b'z' => Ok(character - (b'a' - 10)), b'a'..=b'z' => Ok(character - (b'a' - 10)),
_ => Err(E::custom(format!("invalid charater {}", character))), _ => Err(E::custom(format!("invalid character {}", character))),
} }
} }
} }

View File

@ -47,7 +47,7 @@ fn flatten_nested_tables() {
} }
#[test] #[test]
fn flatten_row_column_explictly() { fn flatten_row_column_explicitly() {
Playground::setup("flatten_test_1", |dirs, sandbox| { Playground::setup("flatten_test_1", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed( sandbox.with_files(vec![FileWithContentToBeTrimmed(
"katz.json", "katz.json",
@ -113,7 +113,7 @@ fn flatten_row_columns_having_same_column_names_flats_separately() {
} }
#[test] #[test]
fn flatten_table_columns_explictly() { fn flatten_table_columns_explicitly() {
Playground::setup("flatten_test_3", |dirs, sandbox| { Playground::setup("flatten_test_3", |dirs, sandbox| {
sandbox.with_files(vec![FileWithContentToBeTrimmed( sandbox.with_files(vec![FileWithContentToBeTrimmed(
"katz.json", "katz.json",

View File

@ -30,7 +30,7 @@ fn add() {
} }
#[test] #[test]
fn add_compount() { fn add_compound() {
let actual = nu!( let actual = nu!(
cwd: "tests/fixtures/formats", pipeline( cwd: "tests/fixtures/formats", pipeline(
r#" r#"

View File

@ -159,7 +159,7 @@ impl PrettyDebug for FormatInlineShape {
InlineShape::Bytesize(bytesize) => { InlineShape::Bytesize(bytesize) => {
// get the config value, if it doesn't exist make it 'auto' so it works how it originally did // get the config value, if it doesn't exist make it 'auto' so it works how it originally did
let filesize_format_var = crate::config::config(Tag::unknown()) let filesize_format_var = crate::config::config(Tag::unknown())
.expect("unabled to get the config.toml file") .expect("unable to get the config.toml file")
.get("filesize_format") .get("filesize_format")
.map(|val| val.convert_to_string().to_ascii_lowercase()) .map(|val| val.convert_to_string().to_ascii_lowercase())
.unwrap_or_else(|| "auto".to_string()); .unwrap_or_else(|| "auto".to_string());

View File

@ -1278,7 +1278,7 @@ pub fn parse_math_expression(
let (orig_left, left) = let (orig_left, left) =
working_exprs.pop().expect("This shouldn't be possible"); working_exprs.pop().expect("This shouldn't be possible");
// If we're in shorthand mode, we need to reparse the left-hand side if possibe // If we're in shorthand mode, we need to reparse the left-hand side if possible
let (left, err) = shorthand_reparse(left, orig_left, scope, shorthand_mode); let (left, err) = shorthand_reparse(left, orig_left, scope, shorthand_mode);
if error.is_none() { if error.is_none() {
error = err; error = err;

View File

@ -5,7 +5,7 @@ use std::io;
/// The `Plugin` trait defines the API which plugins may use to "hook" into nushell. /// The `Plugin` trait defines the API which plugins may use to "hook" into nushell.
pub trait Plugin { pub trait Plugin {
/// The `config` method is used to configure a plguin's user interface / signature. /// The `config` method is used to configure a plugin's user interface / signature.
/// ///
/// This is where the "name" of the plugin (ex `fetch`), description, any required/optional fields, and flags /// This is where the "name" of the plugin (ex `fetch`), description, any required/optional fields, and flags
/// can be defined. This information will displayed in nushell when running help <plugin name> /// can be defined. This information will displayed in nushell when running help <plugin name>

View File

@ -44,7 +44,7 @@ impl PrettyDebug for &PathMember {
} }
} }
/// The fundamental path primitive to descrive how to navigate through a table to get to a sub-item. A path member can be either a word or a number. Words/strings are taken to mean /// The fundamental path primitive to describe how to navigate through a table to get to a sub-item. A path member can be either a word or a number. Words/strings are taken to mean
/// a column name, and numbers are the row number. Taken together they describe which column or row to narrow to in order to get data. /// a column name, and numbers are the row number. Taken together they describe which column or row to narrow to in order to get data.
/// ///
/// Rows must follow column names, they can't come first. eg) `foo.1` is valid where `1.foo` is not. /// Rows must follow column names, they can't come first. eg) `foo.1` is valid where `1.foo` is not.

View File

@ -334,7 +334,7 @@ impl Tag {
} }
} }
/// Creates a `Tag` for the given `AnchorLocatrion` with unknown `Span` position. /// Creates a `Tag` for the given `AnchorLocation` with unknown `Span` position.
pub fn unknown_span(anchor: AnchorLocation) -> Tag { pub fn unknown_span(anchor: AnchorLocation) -> Tag {
Tag { Tag {
anchor: Some(anchor), anchor: Some(anchor),
@ -376,7 +376,7 @@ impl Tag {
/// ///
/// Both `Tag`s must share the same `AnchorLocation`. /// Both `Tag`s must share the same `AnchorLocation`.
/// The resulting `Tag` will have a `Span` that starts from the current `Tag` and ends at `Span` of the given `Tag`. /// The resulting `Tag` will have a `Span` that starts from the current `Tag` and ends at `Span` of the given `Tag`.
/// Should the `None` variant be passed in, a new `Tag` with the same `Span` and `Anchorlocation` will be returned. /// Should the `None` variant be passed in, a new `Tag` with the same `Span` and `AnchorLocation` will be returned.
pub fn until_option(&self, other: Option<impl Into<Tag>>) -> Tag { pub fn until_option(&self, other: Option<impl Into<Tag>>) -> Tag {
match other { match other {
Some(other) => { Some(other) => {

View File

@ -159,11 +159,11 @@ impl TextStyle {
self.color_style.unwrap_or_default().is_strikethrough self.color_style.unwrap_or_default().is_strikethrough
} }
pub fn fg(&self, foregound: Color) -> TextStyle { pub fn fg(&self, foreground: Color) -> TextStyle {
TextStyle { TextStyle {
alignment: self.alignment, alignment: self.alignment,
color_style: Some(Style { color_style: Some(Style {
foreground: Some(foregound), foreground: Some(foreground),
..self.color_style.unwrap_or_default() ..self.color_style.unwrap_or_default()
}), }),
} }

View File

@ -130,7 +130,7 @@ impl Plugin for SubCommand {
fn config(&mut self) -> Result<Signature, ShellError> { fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("chart bar") Ok(Signature::build("chart bar")
.desc("Bar charts") .desc("Bar charts")
.switch("acc", "accumuate values", Some('a')) .switch("acc", "accumulate values", Some('a'))
.optional( .optional(
"columns", "columns",
SyntaxShape::Any, SyntaxShape::Any,

View File

@ -128,7 +128,7 @@ impl Plugin for SubCommand {
fn config(&mut self) -> Result<Signature, ShellError> { fn config(&mut self) -> Result<Signature, ShellError> {
Ok(Signature::build("chart line") Ok(Signature::build("chart line")
.desc("Line charts") .desc("Line charts")
.switch("acc", "accumuate values", Some('a')) .switch("acc", "accumulate values", Some('a'))
.optional( .optional(
"columns", "columns",
SyntaxShape::Any, SyntaxShape::Any,

View File

@ -35,7 +35,7 @@ pub async fn ps(tag: Tag, long: bool) -> Result<Vec<Value>, ShellError> {
.await .await
.map_err(|_| { .map_err(|_| {
ShellError::labeled_error( ShellError::labeled_error(
"Unabled to get process list", "Unable to get process list",
"could not load process list", "could not load process list",
tag.span, tag.span,
) )

View File

@ -18,13 +18,13 @@ impl Plugin for handler::Handler {
.named( .named(
"endpoint", "endpoint",
SyntaxShape::Any, SyntaxShape::Any,
"the enpoint info for the S3 resource, i.g., s3.ap-northeast-1.amazonaws.com or 10.1.1.1", "the endpoint info for the S3 resource, i.g., s3.ap-northeast-1.amazonaws.com or 10.1.1.1",
Some('e'), Some('e'),
) )
.named( .named(
"access_key", "access_key",
SyntaxShape::Any, SyntaxShape::Any,
"the accessy key when authenticating", "the access key when authenticating",
Some('a'), Some('a'),
) )
.named( .named(

View File

@ -117,7 +117,7 @@ async fn host(tag: Tag) -> Result<Value, ShellError> {
// Sessions // Sessions
// note: the heim host module has nomenclature "users" // note: the heim host module has nomenclature "users"
let users = host::users().await.map_err(|_| { let users = host::users().await.map_err(|_| {
ShellError::labeled_error("Unabled to get users", "could not load users", tag.span) ShellError::labeled_error("Unable to get users", "could not load users", tag.span)
})?; })?;
futures::pin_mut!(users); futures::pin_mut!(users);
@ -141,7 +141,7 @@ async fn disks(tag: Tag) -> Result<Option<UntaggedValue>, ShellError> {
let mut output = vec![]; let mut output = vec![];
let partitions = disk::partitions_physical().await.map_err(|_| { let partitions = disk::partitions_physical().await.map_err(|_| {
ShellError::labeled_error( ShellError::labeled_error(
"Unabled to get disk list", "Unable to get disk list",
"could not load disk list", "could not load disk list",
tag.span, tag.span,
) )
@ -301,7 +301,7 @@ async fn net(tag: Tag) -> Result<Option<UntaggedValue>, ShellError> {
let mut output = vec![]; let mut output = vec![];
let io_counters = net::io_counters().await.map_err(|_| { let io_counters = net::io_counters().await.map_err(|_| {
ShellError::labeled_error( ShellError::labeled_error(
"Unabled to get network device list", "Unable to get network device list",
"could not load network device list", "could not load network device list",
tag.span, tag.span,
) )

View File

@ -1,6 +1,6 @@
# from xml # from xml
Parse text as `.xml` and create table. Use this when nushell cannot dertermine the input file extension. Parse text as `.xml` and create table. Use this when nushell cannot determine the input file extension.
Syntax: `from xml` Syntax: `from xml`

View File

@ -42,7 +42,7 @@ Create a file within an already existent folder.
──────────┴─────────── ──────────┴───────────
``` ```
Create three files at oince Create three files at once
```shell ```shell
> touch a b c > touch a b c
> ls > ls
@ -52,4 +52,4 @@ Create three files at oince
0 │ a │ File │ 0 B │ 0 sec ago 0 │ a │ File │ 0 B │ 0 sec ago
1 │ b │ File │ 0 B │ 0 sec ago 1 │ b │ File │ 0 B │ 0 sec ago
2 │ c │ File │ 0 B │ 0 sec ago 2 │ c │ File │ 0 B │ 0 sec ago
────┴────────────────────┴──────┴──────────┴────────────── ────┴────────────────────┴──────┴──────────┴──────────────