Handle CLI arguments as structured argument-parameter pairs
This commit is contained in:
parent
f811c33192
commit
2040854e82
7 changed files with 83 additions and 15 deletions
|
|
@ -1,16 +1,14 @@
|
|||
use axum::{body::Body, extract::Path, http::Response};
|
||||
|
||||
use crate::{formats::populate_graph, types::Node, handlers};
|
||||
use crate::{formats::populate_graph, handlers, types::Node};
|
||||
|
||||
pub async fn node(Path(id): Path<String>) -> Response<Body> {
|
||||
let mut context = tera::Context::new();
|
||||
|
||||
let graph = populate_graph();
|
||||
let nodes = graph.nodes;
|
||||
let empty_node =
|
||||
Node::new(Some(format!("Could not find node with ID {id}.")));
|
||||
let empty_node = Node::new(Some(format!("Could not find node ID {id}.")));
|
||||
|
||||
let node: &Node = nodes.get(&id).unwrap_or(&empty_node);
|
||||
let node: &Node = graph.nodes.get(&id).unwrap_or(&empty_node);
|
||||
|
||||
context.insert("id", &id);
|
||||
context.insert("title", &node.title);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue