Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/man page #52

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,56 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# # Compiled Java class files
# *.class

# # Compiled Python bytecode
# *.py[cod]

# # Log files
# *.log

# # Package files
# *.jar

# # Maven
# target/
# dist/

# # JetBrains IDE
# .idea/

# # Unit test reports
# TEST*.xml

# # Generated by MacOS
# .DS_Store

# # Generated by Windows
# Thumbs.db

# # Applications
# *.app
# *.exe
# *.war

# # Large media files
# *.mp4
# *.tiff
# *.avi
# *.flv
# *.mov
# *.wmv

# # Data
# *.csv
# *.xls
# *.xlsx
# *.zip

# # Pickle files
# .pkl

# # Visualizations
# .png
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,6 @@ members = [

[patch.crates-io]
paperclip = { git = "https://github.com/sonalake/paperclip", branch = "master" }

[build-dependencies]
clap_mangen = "0.1"
18 changes: 16 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
// generated by `sqlx migrate build-script`
fn main() {
fn main() -> std::io::Result<()> {
// trigger recompilation when a new migration is added
println!("cargo:rerun-if-changed=migrations");
//println!("cargo:rerun-if-changed=migrations");

let out_dir = std::path::PathBuf::from(std::env::var_os("OUT_DIR").ok_or_else(|| std::io::ErrorKind::NotFound)?);
conor-sonalake marked this conversation as resolved.
Show resolved Hide resolved

let cmd = clap::Command::new("mybin")
frankhorv marked this conversation as resolved.
Show resolved Hide resolved
.arg(clap::arg!(-n --name <NAME>))
.arg(clap::arg!(-c --count <NUM>));

let man = clap_mangen::Man::new(cmd);
let mut buffer: Vec<u8> = Default::default();
man.render(&mut buffer)?;

std::fs::write(out_dir.join("mybin.1"), buffer)?;

Ok(())
}