src/backend/git.rs, src/backend/render.rs: improvements to API; test_render(1): modifications to fit new API
This commit is contained in:
@@ -24,21 +24,29 @@ use std::{
|
||||
io::stdout,
|
||||
};
|
||||
|
||||
use mintee::backend::render::{ Page, PageKind };
|
||||
use mintee::backend::render::{ Page, PageKind, Repo };
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let path = String::from_utf8(
|
||||
current_dir()?.into_os_string().into_encoded_bytes()
|
||||
let path = current_dir()?;
|
||||
|
||||
let name = String::from_utf8(
|
||||
path.file_name().unwrap().to_os_string().into_encoded_bytes()
|
||||
)?;
|
||||
let entity = String::from_utf8(
|
||||
path.parent().unwrap().as_os_str().to_os_string().into_encoded_bytes()
|
||||
)?;
|
||||
|
||||
let page = Page {
|
||||
kind: PageKind::Repo,
|
||||
path,
|
||||
branch: None,
|
||||
commit: None,
|
||||
tag: None,
|
||||
user: None,
|
||||
};
|
||||
let repo = Repo::new(
|
||||
entity,
|
||||
name,
|
||||
None,
|
||||
Some("src".to_string()),
|
||||
);
|
||||
|
||||
let page = Page::new(
|
||||
PageKind::Repo(repo),
|
||||
None,
|
||||
);
|
||||
|
||||
page.render(Box::new(stdout()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user