add PostBuildCommand
I have implemented the post-build command feature. Here's what I did:
-
Added post-build command parsing in
command_line.rs:- Added handling for the
--post-build-commandargument - The argument requires a value which will be stored in
config.post_build_command
- Added handling for the
-
Created a
post_build_commandfunction ininstall.rs:- Similar to
pre_build_command, it executes a shell command after successful package build - The command has access to
PKGBASEandVERSIONenvironment variables - The command runs in the package build directory
- Similar to
-
Added post-build command execution in
install.rs:- Called
post_build_commandafter a successful package build - Only executes if a post-build command is configured
- Called
-
Added post-build command config in
config.rs:- Added
PostBuildCommandoption to the config file parser - The command can be specified in the config file under the
[bin]section
- Added
Users can specify a post-build command in these ways:
- Via command line:
paru --post-build-command "your-command" - OR Via config file:
[bin]
PostBuildCommand = your-command
The command will receive:
- Current working directory set to the package build directory
PKGBASE: The base package nameVERSION: The package version
Tested with
cargo run -- -S vim-git --post-build-command "/tmp/code/paru/test.sh"
and
paru.conf
#
# Binary OPTIONS
#
[bin]
PostBuildCommand = "/tmp/code/paru/test.sh"
closes #1300
Waiting for feedback where to place
post_build_command(config, dir, base.package_base(), &version)?;
This is useful feature. I noticed that manpage is missing, see https://github.com/Morganamilo/paru/pull/539 for reference.