feat(cli): fmt subcommand

This commit is contained in:
PoiScript 2023-12-21 05:18:32 +08:00
parent de4ff9aa61
commit 9f1a4c84ee
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
2 changed files with 47 additions and 0 deletions

View file

@ -1,12 +1,14 @@
mod detangle;
mod diff;
mod execute_src_block;
mod fmt;
mod tangle;
use clap::{Parser, Subcommand};
use clap_verbosity_flag::{InfoLevel, LevelFilter as CLevelFilter, Verbosity};
use tracing::level_filters::LevelFilter;
/// Command line utility for org-mode files
#[derive(Debug, Parser)]
#[clap(name = "orgize-tools", version)]
pub struct App {
@ -19,14 +21,21 @@ pub struct App {
#[derive(Debug, Subcommand)]
enum Command {
/// Tangle source block contents to destination files
#[clap(name = "tangle")]
Tangle(tangle::Command),
/// Insert tangled file contents back to source files
#[clap(name = "detangle")]
Detangle(detangle::Command),
/// Execute source block
#[clap(name = "execute-src-block")]
ExecuteSrcBlock(execute_src_block::Command),
/// Format org-mode files
#[clap(name = "fmt")]
Format(fmt::Command),
}
fn main() -> anyhow::Result<()> {
@ -50,5 +59,6 @@ fn main() -> anyhow::Result<()> {
Command::Tangle(cmd) => cmd.run(),
Command::Detangle(cmd) => cmd.run(),
Command::ExecuteSrcBlock(cmd) => cmd.run(),
Command::Format(cmd) => cmd.run(),
}
}