Skip to content

Commit 1bebaf3

Browse files
committed
new: simplified view
1 parent ae998ae commit 1bebaf3

File tree

4 files changed

+16
-114
lines changed

4 files changed

+16
-114
lines changed

Cargo.lock

Lines changed: 0 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ actix-web-lab = "0.23.0"
1616
anyhow = "1.0.90"
1717
camino = { version = "1.1.9", features = ["serde"] }
1818
clap = { version = "4.5.20", features = ["derive"] }
19-
comfy-table = "7.1.1"
2019
env_logger = "0.11.5"
2120
futures = "0.3.31"
2221
glob = "0.3.1"

src/book/runtime.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl ExecutionFlavor {
4343
match self {
4444
Self::Shell(shell) => shell.to_string(),
4545
Self::Sudo => "sudo".to_string(),
46-
Self::Docker(_) => "docker".to_string(),
46+
Self::Docker(image) => format!("docker {}", image),
4747
Self::Error(message) => message.to_string(),
4848
}
4949
}

src/cli/view.rs

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,30 @@
1-
use comfy_table::Table;
2-
31
use crate::book::{runtime::ExecutionFlavor, Book};
42

53
use super::ViewArgs;
64

75
pub(crate) async fn view(args: ViewArgs) -> anyhow::Result<()> {
86
let book = Book::from_path(args.path, args.filter)?;
97

10-
let mut table = Table::new();
11-
12-
table.set_header(vec!["page", "function", "context", "description"]);
13-
148
for (_, page) in book.pages {
15-
let mut first_page = true;
9+
println!("{} > [{}]", page.categories.join(" > "), page.name);
10+
1611
for (function_name, function) in page.functions {
17-
if first_page {
18-
table.add_row(vec![
19-
format!("{} > {}", page.categories.join(" > "), &page.name),
20-
function_name,
21-
ExecutionFlavor::for_function(&function)?.to_string(),
22-
function.description,
23-
]);
24-
first_page = false;
25-
} else {
26-
table.add_row(vec![
27-
"".to_owned(),
28-
function_name,
29-
ExecutionFlavor::for_function(&function)?.to_string(),
30-
function.description,
31-
]);
12+
println!(" * {} : {}", function_name, function.description);
13+
println!(
14+
" running with: {}",
15+
ExecutionFlavor::for_function(&function)?.to_string()
16+
);
17+
println!(" parameters:");
18+
for (parameter_name, parameter) in &function.parameters {
19+
println!(
20+
" {{${}}} : {}",
21+
parameter_name, parameter.description
22+
);
3223
}
24+
25+
println!();
3326
}
3427
}
3528

36-
println!("\n{}", table);
37-
3829
Ok(())
3930
}

0 commit comments

Comments
 (0)