Adds unimplemented module, tests.

This commit is contained in:
Thomas Hartmann
2019-10-13 21:15:30 +02:00
parent 5ec6bac7d9
commit 648d4865b1
3 changed files with 101 additions and 0 deletions

View File

@ -22,6 +22,7 @@ pub(crate) mod from_csv;
pub(crate) mod from_ini;
pub(crate) mod from_json;
pub(crate) mod from_sqlite;
pub(crate) mod from_ssv;
pub(crate) mod from_toml;
pub(crate) mod from_tsv;
pub(crate) mod from_url;
@ -91,6 +92,7 @@ pub(crate) use from_ini::FromINI;
pub(crate) use from_json::FromJSON;
pub(crate) use from_sqlite::FromDB;
pub(crate) use from_sqlite::FromSQLite;
pub(crate) use from_ssv::FromSSV;
pub(crate) use from_toml::FromTOML;
pub(crate) use from_tsv::FromTSV;
pub(crate) use from_url::FromURL;

43
src/commands/from_ssv.rs Normal file
View File

@ -0,0 +1,43 @@
use crate::commands::WholeStreamCommand;
use crate::data::{Primitive, TaggedDictBuilder, Value};
use crate::prelude::*;
pub struct FromSSV;
#[derive(Deserialize)]
pub struct FromSSVArgs {
headerless: bool,
}
const STRING_REPRESENTATION: &str = "from-ssv";
impl WholeStreamCommand for FromSSV {
fn name(&self) -> &str {
STRING_REPRESENTATION
}
fn signature(&self) -> Signature {
Signature::build(STRING_REPRESENTATION).switch("headerless")
}
fn usage(&self) -> &str {
"Parse text as .ssv and create a table."
}
fn run(
&self,
args: CommandArgs,
registry: &CommandRegistry,
) -> Result<OutputStream, ShellError> {
args.process(registry, from_ssv)?.run()
}
}
fn from_ssv(
FromSSVArgs {
headerless: headerless,
}: FromSSVArgs,
RunnableContext { input, name, .. }: RunnableContext,
) -> Result<OutputStream, ShellError> {
unimplemented!()
}