mirror of https://codeberg.org/topola/topola.git
manpage: ported to clap-mangen
This commit is contained in:
parent
ad0787e1ee
commit
fdb50aeab9
|
|
@ -24,3 +24,7 @@ Cargo.lock
|
|||
|
||||
# ---> Topola
|
||||
*.ses
|
||||
dist/
|
||||
|
||||
# ignore manpages
|
||||
topola.1
|
||||
|
|
|
|||
|
|
@ -122,3 +122,7 @@ opt-level = 2
|
|||
|
||||
[patch.crates-io]
|
||||
contracts = { path = "vendored/contracts" }
|
||||
|
||||
[build-dependencies]
|
||||
clap_mangen = "0.2.23"
|
||||
clap = {version="4.5.8", features = ["derive"] }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
include!("src/bin/topola/cli.rs");
|
||||
use clap_mangen::Man;
|
||||
use clap::CommandFactory;
|
||||
use std::fs::File;
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let cli = Cli::command();
|
||||
let man = Man::new(cli);
|
||||
let mut file = File::create(concat!("assets", "/topola.1"))?;
|
||||
man.render(&mut file)?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
#! /bin/bash
|
||||
help2man topola -s 1 -o topola.1 --no-info -n "topological router and autorouter for printed circuit boards"
|
||||
gzip topola.1
|
||||
|
||||
# to test purposes
|
||||
# sudo cp topola.1.gz /usr/share/man/man1
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
use clap::Parser;
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
||||
#[derive(Parser, Debug, Default)]
|
||||
#[command(about, version)]
|
||||
pub struct Cli {
|
||||
#[arg(value_name = "SPECCTRA DESIGN FILE",
|
||||
help = "Specify the Specctra Design (*.dsn) file input file for the Topola autorouter")]
|
||||
pub input: PathBuf,
|
||||
#[arg(short, long, value_name = "FILE",
|
||||
help = "Specify the output Topola session file (*.ses)")
|
||||
]
|
||||
pub output: Option<PathBuf>,
|
||||
#[arg(short, long, value_name = "FILE", help = "TODO")]
|
||||
pub commands: Option<PathBuf>,
|
||||
}
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
use clap::{Error, Parser};
|
||||
use clap::Parser;
|
||||
use std::fs::File;
|
||||
use std::io::prelude::*;
|
||||
use std::io::BufReader;
|
||||
use std::path::PathBuf;
|
||||
use topola::autorouter::history::History;
|
||||
use topola::autorouter::invoker::Command;
|
||||
use topola::autorouter::invoker::Invoker;
|
||||
|
|
@ -10,19 +8,9 @@ use topola::autorouter::selection::PinSelection;
|
|||
use topola::autorouter::Autorouter;
|
||||
use topola::specctra::design::SpecctraDesign;
|
||||
|
||||
#[derive(Parser, Debug, Default)]
|
||||
#[command(about, version)]
|
||||
struct Cli {
|
||||
#[arg(value_name = "SPECCTRA DESIGN FILE",
|
||||
help = "Specify the Specctra Design (*.dsn) file input file for the Topola autorouter")]
|
||||
input: PathBuf,
|
||||
#[arg(short, long, value_name = "FILE",
|
||||
help = "Specify the output Topola session file (*.ses)")
|
||||
]
|
||||
output: Option<PathBuf>,
|
||||
#[arg(short, long, value_name = "FILE", help = "TODO")]
|
||||
commands: Option<PathBuf>,
|
||||
}
|
||||
// TODO: should this or include macro be used?
|
||||
pub mod cli;
|
||||
use cli::Cli;
|
||||
|
||||
fn main() -> Result<(), std::io::Error> {
|
||||
let args = Cli::parse();
|
||||
|
|
|
|||
Loading…
Reference in New Issue