master
six 2022-01-10 13:01:11 +01:00
parent f6c2773611
commit 6b3a68235a
1 changed files with 25 additions and 6 deletions

View File

@ -1,16 +1,35 @@
use std::io::stdin;
use std::fs;
use rusqlite::{Connection, Result};
use rusqlite::NO_PARAMS;
fn main() {
// Input to skills
// 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 - format?
let content = fs::read_to_string("../../skills.txt").expect("Error while reading file.");
println!("All skills:\n{}", content)
// Read Skills files -> sqlite?
//let content = fs::read_to_string("../../skills.txt").expect("Error while reading file.");
//println!("All skills:\n{}", content)
// List skill levels
// ...
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(())
}