File tree Expand file tree Collapse file tree 3 files changed +27
-1
lines changed
git-branchless/src/commands Expand file tree Collapse file tree 3 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ use lib::util::ExitCode;
2222use path_slash:: PathExt ;
2323use tracing:: { instrument, warn} ;
2424
25- use git_branchless_opts:: { write_man_pages, InitArgs } ;
25+ use git_branchless_opts:: { write_man_pages, InitArgs , InstallManPagesArgs } ;
2626use lib:: core:: config:: { get_default_branch_name, get_default_hooks_dir, get_hooks_dir} ;
2727use lib:: core:: dag:: Dag ;
2828use lib:: core:: effects:: Effects ;
@@ -684,6 +684,17 @@ pub fn command_main(ctx: CommandContext, args: InitArgs) -> eyre::Result<ExitCod
684684 }
685685}
686686
687+ /// Install the man-pages for `git-branchless` to the provided path.
688+ #[ instrument]
689+ pub fn command_install_man_pages (
690+ ctx : CommandContext ,
691+ args : InstallManPagesArgs ,
692+ ) -> eyre:: Result < ExitCode > {
693+ let InstallManPagesArgs { path } = args;
694+ write_man_pages ( & path) ?;
695+ Ok ( ExitCode ( 0 ) )
696+ }
697+
687698#[ cfg( test) ]
688699mod tests {
689700 use super :: { update_between_lines, ALL_ALIASES , UPDATE_MARKER_END , UPDATE_MARKER_START } ;
Original file line number Diff line number Diff line change @@ -265,6 +265,14 @@ pub struct InitArgs {
265265 pub main_branch_name : Option < String > ,
266266}
267267
268+ /// Install git-branchless's man-pages to the given path.
269+ #[ derive( Debug , Parser ) ]
270+ pub struct InstallManPagesArgs {
271+ /// The path to install to. An example path might be `/usr/share/man`. The
272+ /// provded path will be appended with `man1`, etc., as appropriate.
273+ pub path : PathBuf ,
274+ }
275+
268276/// Query the commit graph using the "revset" language and print matching
269277/// commits.
270278///
@@ -425,6 +433,9 @@ pub enum Command {
425433 /// Initialize the branchless workflow for this repository.
426434 Init ( InitArgs ) ,
427435
436+ /// Install git-branchless's man-pages to the given path.
437+ InstallManPages ( InstallManPagesArgs ) ,
438+
428439 /// Move a subtree of commits from one location to another.
429440 ///
430441 /// By default, `git move` tries to move the entire current stack if you
Original file line number Diff line number Diff line change @@ -70,6 +70,10 @@ fn command_main(ctx: CommandContext, opts: Opts) -> eyre::Result<ExitCode> {
7070
7171 Command :: Init ( args) => git_branchless_init:: command_main ( ctx, args) ?,
7272
73+ Command :: InstallManPages ( args) => {
74+ git_branchless_init:: command_install_man_pages ( ctx, args) ?
75+ }
76+
7377 Command :: Move {
7478 source,
7579 dest,
You can’t perform that action at this time.
0 commit comments