mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 05:24:56 +02:00
Rust 1.85, edition=2024 (#15741)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
authors = ["The Nushell Project Developers"]
|
||||
description = "A Nushell plugin to query JSON, XML, and various web data"
|
||||
repository = "https://github.com/nushell/nushell/tree/main/crates/nu_plugin_query"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
name = "nu_plugin_query"
|
||||
version = "0.104.1"
|
||||
@ -25,4 +25,4 @@ sxd-document = "0.3"
|
||||
sxd-xpath = "0.4"
|
||||
webpage = { version = "2.0.1", features = ["serde"] }
|
||||
serde_json.workspace = true
|
||||
serde.workspace = true
|
||||
serde.workspace = true
|
||||
|
@ -6,7 +6,7 @@ mod query_xml;
|
||||
mod web_tables;
|
||||
|
||||
pub use query::Query;
|
||||
pub use query_json::{execute_json_query, QueryJson};
|
||||
pub use query_web::{parse_selector_params, QueryWeb};
|
||||
pub use query_xml::{execute_xpath_query, QueryXml};
|
||||
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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
use nu_plugin::{serve_plugin, JsonSerializer};
|
||||
use nu_plugin::{JsonSerializer, serve_plugin};
|
||||
use nu_plugin_query::Query;
|
||||
|
||||
fn main() {
|
||||
|
@ -179,7 +179,7 @@ fn convert_gjson_value_to_nu_value(v: &gjValue, span: Span) -> Value {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use gjson::{valid, Value as gjValue};
|
||||
use gjson::{Value as gjValue, valid};
|
||||
|
||||
#[test]
|
||||
fn validate_string() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use crate::{web_tables::WebTable, Query};
|
||||
use crate::{Query, web_tables::WebTable};
|
||||
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
|
||||
use nu_protocol::{
|
||||
Category, Example, LabeledError, Record, Signature, Span, Spanned, SyntaxShape, Value,
|
||||
@ -452,15 +452,17 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_first_child_is_not_empty() {
|
||||
assert!(!execute_selector_query(
|
||||
SIMPLE_LIST,
|
||||
null_spanned("li:first-child"),
|
||||
false,
|
||||
null_spanned(&false),
|
||||
Span::test_data()
|
||||
assert!(
|
||||
!execute_selector_query(
|
||||
SIMPLE_LIST,
|
||||
null_spanned("li:first-child"),
|
||||
false,
|
||||
null_spanned(&false),
|
||||
Span::test_data()
|
||||
)
|
||||
.unwrap()
|
||||
.is_empty()
|
||||
)
|
||||
.unwrap()
|
||||
.is_empty())
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::Query;
|
||||
use nu_plugin::{EngineInterface, EvaluatedCall, SimplePluginCommand};
|
||||
use nu_protocol::{
|
||||
record, Category, LabeledError, Record, Signature, Span, Spanned, SyntaxShape, Value,
|
||||
Category, LabeledError, Record, Signature, Span, Spanned, SyntaxShape, Value, record,
|
||||
};
|
||||
use sxd_document::parser;
|
||||
use sxd_xpath::{Context, Factory};
|
||||
@ -48,7 +48,7 @@ pub fn execute_xpath_query(
|
||||
None => {
|
||||
return Err(
|
||||
LabeledError::new("problem with input data").with_label("query missing", call.head)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -132,7 +132,7 @@ fn build_xpath(xpath_str: &str, span: Span) -> Result<sxd_xpath::XPath, LabeledE
|
||||
mod tests {
|
||||
use super::execute_xpath_query as query;
|
||||
use nu_plugin::EvaluatedCall;
|
||||
use nu_protocol::{record, Span, Spanned, Value};
|
||||
use nu_protocol::{Span, Spanned, Value, record};
|
||||
|
||||
#[test]
|
||||
fn position_function_in_predicate() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::query_web::css;
|
||||
use scraper::{element_ref::ElementRef, Html, Selector as ScraperSelector};
|
||||
use scraper::{Html, Selector as ScraperSelector, element_ref::ElementRef};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub type Headers = HashMap<String, usize>;
|
||||
|
Reference in New Issue
Block a user