IRLrpg/code/src/main.rs

36 lines
954 B
Rust

use std::io::stdin;
use std::fs;
use rusqlite::{Connection, Result};
use rusqlite::NO_PARAMS;
fn main() {
// Input from cli
let mut input_string = String::new();
stdin().read_line(&mut input_string).ok().expect("Error while reading input.");
println!("{:?}", input_string);
// Read Skills files -> sqlite?
//let content = fs::read_to_string("../../skills.txt").expect("Error while reading file.");
//println!("All skills:\n{}", content)
let conn = Connection::open("irlpg.db")?;
conn.execute(
"create table if not exists skill_levels (
id integer primary key,
name text not null unique
)",
NO_PARAMS,
)?;
conn.execute(
"create table if not exists skills (
id integer primary key,
name text not null,
color_id integer not null references skill_levels(id)
)",
NO_PARAMS,
)?;
Ok(())
}