Skip to content

Commit

Permalink
parse: add feature to parse and upload msg files
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-prosser committed Oct 25, 2023
1 parent 9dcf515 commit 1142dc1
Show file tree
Hide file tree
Showing 9 changed files with 470 additions and 4 deletions.
23 changes: 21 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ reinfer-client = { version = "0.19.0", path = "../api" }
dialoguer = "0.10.4"
scoped_threadpool = "0.1.9"
backoff = "0.4.0"
cfb = "0.9.0"
encoding_rs = "0.8.33"

[dev-dependencies]
pretty_assertions = "1.3.0"
Expand Down
9 changes: 8 additions & 1 deletion cli/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::{
commands::{
config::ConfigArgs, create::CreateArgs, delete::DeleteArgs, get::GetArgs,
config::ConfigArgs, create::CreateArgs, delete::DeleteArgs, get::GetArgs, parse::ParseArgs,
update::UpdateArgs,
},
printer::OutputFormat,
Expand Down Expand Up @@ -104,6 +104,13 @@ pub enum Command {
#[structopt(subcommand)]
get_args: GetArgs,
},

#[structopt(name = "parse")]
/// Upload data from various file types
Parse {
#[structopt(subcommand)]
parse_args: ParseArgs,
},
}

#[derive(Debug)]
Expand Down
1 change: 1 addition & 0 deletions cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ pub mod config;
pub mod create;
pub mod delete;
pub mod get;
pub mod parse;
pub mod update;

pub fn ensure_uip_user_consents_to_ai_unit_charge(base_url: &Url) -> Result<()> {
Expand Down
21 changes: 21 additions & 0 deletions cli/src/commands/parse/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
mod msgs;

use anyhow::Result;
use reinfer_client::Client;
use structopt::StructOpt;

use self::msgs::ParseMsgArgs;

#[derive(Debug, StructOpt)]
pub enum ParseArgs {
#[structopt(name = "msgs")]
/// Parse unicode msg files. Note: Currently the body is processed as plain text.
/// Html bodies are not supported.
Msgs(ParseMsgArgs),
}

pub fn run(args: &ParseArgs, client: Client) -> Result<()> {
match args {
ParseArgs::Msgs(parse_msg_args) => msgs::parse(&client, parse_msg_args),
}
}
Loading

0 comments on commit 1142dc1

Please sign in to comment.