aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-08-27 01:17:59 -0400
committerJesse Luehrs <doy@tozt.net>2019-08-27 01:17:59 -0400
commit426bcffb2cd6f7b1e8ff95b5e0772e48ba28988f (patch)
treeaeaddf57b9f6bb406d4a312310f677b5c6f0477d /src
parentd8b6975f3648bef228060f71480c86cc2d9cd540 (diff)
downloadynab-export-426bcffb2cd6f7b1e8ff95b5e0772e48ba28988f.tar.gz
ynab-export-426bcffb2cd6f7b1e8ff95b5e0772e48ba28988f.zip
add a command to dump the schema too
Diffstat (limited to 'src')
-rw-r--r--src/main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 218cf46..965467a 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -4,6 +4,8 @@ const PROJECT_NAME: &str = "ynab";
// XXX is this fixed? or is it specific to my account?
const SPLIT_CATEGORY_ID: &str = "4f42d139-ded2-4782-b16e-e944868fbf62";
+const SCHEMA: &str = include_str!("../data/schema.sql");
+
pub fn api_key() -> std::path::PathBuf {
directories::ProjectDirs::from("", "", PROJECT_NAME)
.unwrap()
@@ -24,6 +26,11 @@ pub fn read_api_key() -> String {
#[allow(clippy::cognitive_complexity)]
fn main() {
+ if std::env::args().nth(1) == Some("schema".to_string()) {
+ print!("{}", SCHEMA);
+ std::process::exit(0);
+ }
+
let key = read_api_key();
let mut ynab_config = ynab_api::apis::configuration::Configuration::new();
ynab_config.api_key = Some(ynab_api::apis::configuration::ApiKey {