Support installing manager service with custom arguments

pull/191/head
Chip Senkbeil 12 months ago
parent 76dc7cf1fa
commit af903013f6
No known key found for this signature in database
GPG Key ID: 35EF1F8EC72A4131

@ -113,7 +113,11 @@ async fn async_run(cmd: ManagerSubcommand) -> CliResult {
.context("Failed to stop service")?; .context("Failed to stop service")?;
Ok(()) Ok(())
} }
ManagerSubcommand::Service(ManagerServiceSubcommand::Install { kind, user }) => { ManagerSubcommand::Service(ManagerServiceSubcommand::Install {
kind,
user,
args: extra_args,
}) => {
debug!("Installing manager service via {:?}", kind); debug!("Installing manager service via {:?}", kind);
let mut manager = <dyn ServiceManager>::target_or_native(kind) let mut manager = <dyn ServiceManager>::target_or_native(kind)
.context("Failed to detect native service manager")?; .context("Failed to detect native service manager")?;
@ -126,6 +130,10 @@ async fn async_run(cmd: ManagerSubcommand) -> CliResult {
.context("Failed to set service manager to user level")?; .context("Failed to set service manager to user level")?;
} }
for arg in extra_args {
args.push(arg.into());
}
manager manager
.install(ServiceInstallCtx { .install(ServiceInstallCtx {
label: SERVICE_LABEL.clone(), label: SERVICE_LABEL.clone(),

@ -1034,6 +1034,10 @@ pub enum ManagerServiceSubcommand {
/// If specified, installs as a user-level service /// If specified, installs as a user-level service
#[clap(long)] #[clap(long)]
user: bool, user: bool,
/// Additional arguments to provide to the manager when started
#[clap(name = "ARGS", last = true)]
args: Vec<String>,
}, },
/// Uninstall the manager as a service /// Uninstall the manager as a service

Loading…
Cancel
Save