mirror of
https://github.com/nushell/nushell.git
synced 2025-08-10 14:48:44 +02:00
This commit is contained in:
@ -2,7 +2,7 @@ use super::delimited::from_delimited_data;
|
||||
|
||||
use nu_protocol::ast::Call;
|
||||
use nu_protocol::engine::{Command, EngineState, Stack};
|
||||
use nu_protocol::{Category, Config, PipelineData, ShellError, Signature};
|
||||
use nu_protocol::{Category, Config, Example, PipelineData, ShellError, Signature};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct FromTsv;
|
||||
@ -36,6 +36,21 @@ impl Command for FromTsv {
|
||||
let config = stack.get_config().unwrap_or_default();
|
||||
from_tsv(call, input, &config)
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<Example> {
|
||||
vec![
|
||||
Example {
|
||||
description: "Create a tsv file with header columns and open it",
|
||||
example: r#"echo $'c1(char tab)c2(char tab)c3(char nl)1(char tab)2(char tab)3' | save tsv-data | open tsv-data | from tsv"#,
|
||||
result: None,
|
||||
},
|
||||
Example {
|
||||
description: "Create a tsv file without header columns and open it",
|
||||
example: r#"echo $'a1(char tab)b1(char tab)c1(char nl)a2(char tab)b2(char tab)c2' | save tsv-data | open tsv-data | from tsv -n"#,
|
||||
result: None,
|
||||
},
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
fn from_tsv(call: &Call, input: PipelineData, config: &Config) -> Result<PipelineData, ShellError> {
|
||||
|
Reference in New Issue
Block a user