+35
src/main.rs
+35
src/main.rs
···
1
+
fn help() {
2
+
println!("tangled-on-commit")
3
+
}
4
+
5
+
#[derive(Debug)]
6
+
struct Config {
7
+
handle: String,
8
+
repo_name: String,
9
+
shell: String,
10
+
}
11
+
12
+
fn load_config() -> Result<Config, ()> {
13
+
// load config from cli args if present
14
+
// if omitted, fallback to a local `tangled-on-commit.json` file
15
+
// if key omitted or file not found, fall back to env
16
+
// if env omitted, error out and quit
17
+
18
+
return Ok(Config {
19
+
handle: String::from(""),
20
+
repo_name: String::from(""),
21
+
shell: String::from("")
22
+
});
23
+
}
24
+
25
fn main() -> Result<(), i32> {
26
+
27
// load configuration
28
+
let config = match load_config() {
29
+
Ok(res) => res,
30
+
Err(_) => {
31
+
// q
32
+
return Err(1)
33
+
}
34
+
};
35
+
36
+
help();
37
+
println!("{:#?}", config);
38
39
// resolve handle to did
40
// resolve did+repoName to knotserver