Add command 'docs' for generating project documentation.
This commit is contained in:
parent
6da53fd875
commit
1f3f769b53
|
@ -0,0 +1,22 @@
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
#[derive(clap::Args)]
|
||||||
|
/// Build an Aiken project
|
||||||
|
pub struct Args {
|
||||||
|
/// Path to project
|
||||||
|
#[clap(short, long)]
|
||||||
|
directory: Option<PathBuf>,
|
||||||
|
|
||||||
|
/// Output directory for the documentation
|
||||||
|
#[clap(short = 'o', long)]
|
||||||
|
destination: Option<PathBuf>,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn exec(
|
||||||
|
Args {
|
||||||
|
directory,
|
||||||
|
destination,
|
||||||
|
}: Args,
|
||||||
|
) -> miette::Result<()> {
|
||||||
|
crate::with_project(directory, |p| p.docs(destination.clone()))
|
||||||
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
pub mod build;
|
pub mod build;
|
||||||
pub mod check;
|
pub mod check;
|
||||||
|
pub mod docs;
|
||||||
pub mod error;
|
pub mod error;
|
||||||
pub mod fmt;
|
pub mod fmt;
|
||||||
pub mod lsp;
|
pub mod lsp;
|
||||||
|
|
|
@ -68,6 +68,19 @@ impl telemetry::EventListener for Terminal {
|
||||||
root.to_str().unwrap_or("").bright_blue()
|
root.to_str().unwrap_or("").bright_blue()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
telemetry::Event::GeneratingDocumentation {
|
||||||
|
name,
|
||||||
|
version,
|
||||||
|
root,
|
||||||
|
} => {
|
||||||
|
println!(
|
||||||
|
"{} {} {} ({})",
|
||||||
|
"Generating documentation".bold().purple(),
|
||||||
|
name.bold(),
|
||||||
|
version,
|
||||||
|
root.to_str().unwrap_or("").bright_blue()
|
||||||
|
);
|
||||||
|
}
|
||||||
telemetry::Event::ParsingProjectFiles => {
|
telemetry::Event::ParsingProjectFiles => {
|
||||||
println!("{}", "...Parsing project files".bold().purple());
|
println!("{}", "...Parsing project files".bold().purple());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use aiken::cmd::{build, check, fmt, lsp, new, tx, uplc};
|
use aiken::cmd::{build, check, docs, fmt, lsp, new, tx, uplc};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
/// Aiken: a smart-contract language and toolchain for Cardano
|
/// Aiken: a smart-contract language and toolchain for Cardano
|
||||||
|
@ -11,6 +11,7 @@ pub enum Cmd {
|
||||||
Fmt(fmt::Args),
|
Fmt(fmt::Args),
|
||||||
Build(build::Args),
|
Build(build::Args),
|
||||||
Check(check::Args),
|
Check(check::Args),
|
||||||
|
Docs(docs::Args),
|
||||||
|
|
||||||
#[clap(hide = true)]
|
#[clap(hide = true)]
|
||||||
Lsp(lsp::Args),
|
Lsp(lsp::Args),
|
||||||
|
@ -34,6 +35,7 @@ fn main() -> miette::Result<()> {
|
||||||
Cmd::New(args) => new::exec(args),
|
Cmd::New(args) => new::exec(args),
|
||||||
Cmd::Fmt(args) => fmt::exec(args),
|
Cmd::Fmt(args) => fmt::exec(args),
|
||||||
Cmd::Build(args) => build::exec(args),
|
Cmd::Build(args) => build::exec(args),
|
||||||
|
Cmd::Docs(args) => docs::exec(args),
|
||||||
Cmd::Check(args) => check::exec(args),
|
Cmd::Check(args) => check::exec(args),
|
||||||
Cmd::Lsp(args) => lsp::exec(args),
|
Cmd::Lsp(args) => lsp::exec(args),
|
||||||
Cmd::Tx(sub_cmd) => tx::exec(sub_cmd),
|
Cmd::Tx(sub_cmd) => tx::exec(sub_cmd),
|
||||||
|
|
Loading…
Reference in New Issue