Skip to content

Commit

Permalink
add authors and copyright info to man page
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Dec 11, 2023
1 parent cab0fb2 commit 0bf84d5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions complete/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ pub struct Command<'a> {
pub version: &'a str,
pub after_options: &'a str,
pub args: Vec<Arg<'a>>,
pub license: &'a str,
pub authors: &'a str,
}

/// Description of an argument
Expand Down
7 changes: 7 additions & 0 deletions complete/src/man.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,12 @@ pub fn render(c: &Command) -> String {
page.text(flags);
page.text([roman(arg.help)]);
}

page.control("SH", ["AUTHORS"]);
page.text([roman(c.authors)]);

page.control("SH", ["COPYRIGHT"]);
page.text([roman(format!("Copyright © {}.", &c.authors))]);
page.text([roman(format!("License: {}", &c.license))]);
page.render()
}
4 changes: 3 additions & 1 deletion derive/src/complete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ pub fn complete(args: &[Argument], file: &Option<String>) -> TokenStream {
summary: #summary,
after_options: #after_options,
version: env!("CARGO_PKG_VERSION"),
args: vec![#(#arg_specs),*]
args: vec![#(#arg_specs),*],
license: env!("CARGO_PKG_LICENSE"),
authors: env!("CARGO_PKG_AUTHORS"),
})
}

0 comments on commit 0bf84d5

Please sign in to comment.