mirror of
https://github.com/nushell/nushell.git
synced 2025-02-05 05:00:11 +01:00
more s3 work.. saving
This commit is contained in:
parent
4c5467d595
commit
8be4ef9ccd
@ -124,6 +124,16 @@ enum Resource {
|
|||||||
CloudUrl(String, CloudOptions, Span)
|
CloudUrl(String, CloudOptions, Span)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Resource {
|
||||||
|
fn file_type(&self) ->Option<PolarsFileType> {
|
||||||
|
let extension = match self {
|
||||||
|
Self::File(p, _) => p.extension().map(|s| s.to_string_lossy()),
|
||||||
|
Self::CloudUrl(p, _, _) => p.ri
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
fn command(
|
fn command(
|
||||||
plugin: &PolarsPlugin,
|
plugin: &PolarsPlugin,
|
||||||
engine: &nu_plugin::EngineInterface,
|
engine: &nu_plugin::EngineInterface,
|
||||||
@ -131,13 +141,12 @@ fn command(
|
|||||||
) -> Result<PipelineData, ShellError> {
|
) -> Result<PipelineData, ShellError> {
|
||||||
let spanned_file: Spanned<String> = call.req(0)?;
|
let spanned_file: Spanned<String> = call.req(0)?;
|
||||||
|
|
||||||
let resources = if let Some(cloud_options) = crate::cloud::build_cloud_options(plugin, &spanned_file.item)? {
|
let resource = if let Some(cloud_options) = crate::cloud::build_cloud_options(plugin, &spanned_file.item)? {
|
||||||
Resource::CloudUrl(spanned_file.item, cloud_options, spanned_file.span)
|
Resource::CloudUrl(spanned_file.item, cloud_options, spanned_file.span)
|
||||||
} else {
|
} else {
|
||||||
|
let path = expand_path_with(&spanned_file.item, engine.get_current_dir()?, true);
|
||||||
}
|
Resource::File(path, spanned_file.span)
|
||||||
let file_path = expand_path_with(&spanned_file.item, engine.get_current_dir()?, true);
|
};
|
||||||
let file_span = spanned_file.span;
|
|
||||||
|
|
||||||
let type_option: Option<(String, Span)> = call
|
let type_option: Option<(String, Span)> = call
|
||||||
.get_flag("type")?
|
.get_flag("type")?
|
||||||
@ -187,7 +196,7 @@ fn from_parquet(
|
|||||||
file_span: Span,
|
file_span: Span,
|
||||||
) -> Result<Value, ShellError> {
|
) -> Result<Value, ShellError> {
|
||||||
|
|
||||||
let cloud_options = crate::cloud::build_cloud_options(plugin, file_path)
|
let cloud_options = crate::cloud::build_cloud_options(plugin, file_path)?;
|
||||||
if !call.has_flag("eager")? {
|
if !call.has_flag("eager")? {
|
||||||
let file: String = call.req(0)?;
|
let file: String = call.req(0)?;
|
||||||
let mut args = ScanArgsParquet::default();
|
let mut args = ScanArgsParquet::default();
|
||||||
|
Loading…
Reference in New Issue
Block a user