Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

main.rs 1.2 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
  1. mod error;
  2. mod cleaning;
  3. mod tsv;
  4. mod db;
  5. mod logging;
  6. mod commands;
  7. use structopt::StructOpt;
  8. use std::io;
  9. use std::fs::File;
  10. use std::path::PathBuf;
  11. use indicatif::{ProgressBar, ProgressStyle};
  12. use error::Result;
  13. use logging::LogOpts;
  14. use commands::*;
  15. /// BookData import tools
  16. #[derive(StructOpt, Debug)]
  17. #[structopt(name="bookdata")]
  18. struct Opt {
  19. #[structopt(flatten)]
  20. logging: LogOpts,
  21. #[structopt(subcommand)]
  22. command: Command
  23. }
  24. #[derive(StructOpt, Debug)]
  25. #[allow(non_camel_case_types)]
  26. enum Command {
  27. /// Output a file with a progress bar
  28. pcat(pcat::Options),
  29. /// Make a UUID
  30. #[structopt(name="make-uuid")]
  31. make_uuid(make_uuid::Options),
  32. /// Parse a MARC XML file
  33. #[structopt(name="parse-marc")]
  34. parse_marc(parse_marc::Options),
  35. /// Import JSON data
  36. #[structopt(name="import-json")]
  37. import_json(import_json::Options)
  38. }
  39. fn main() -> Result<()> {
  40. let opt = Opt::from_args();
  41. opt.logging.init()?;
  42. match opt.command {
  43. Command::pcat(opts) => pcat::exec(opts),
  44. Command::make_uuid(opts) => make_uuid::exec(opts),
  45. Command::parse_marc(opts) => parse_marc::exec(opts),
  46. Command::import_json(opts) => import_json::exec(opts)
  47. }
  48. }
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...