[v2] pacman: silence "info" msg when using --print

Message ID 20220307171813.23982-1-jean@raby.sh
State Accepted, archived
Headers show
Series [v2] pacman: silence "info" msg when using --print | expand

Commit Message

Jean Raby March 7, 2022, 5:18 p.m. UTC
This allows for parsing the output of:
    pacman --upgrade --print-format '<format>' pkg.zst

without having to remove info messages from it.
---
 src/pacman/upgrade.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Allan McRae June 25, 2022, 12:44 p.m. UTC | #1
On 8/3/22 03:18, Jean Raby wrote:
> This allows for parsing the output of:
>      pacman --upgrade --print-format '<format>' pkg.zst
> 
> without having to remove info messages from it.
> ---
>   src/pacman/upgrade.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
> index 0691856f..279609a4 100644
> --- a/src/pacman/upgrade.c
> +++ b/src/pacman/upgrade.c
> @@ -99,7 +99,9 @@ int pacman_upgrade(alpm_list_t *targets)
>   		goto fail_free;
>   	}
>   
> -	printf(_("loading packages...\n"));
> +	if(!config->print) {
> +		printf(_("loading packages...\n"));
> +	}

Thanks.  Applied


>   	retval |= load_packages(local_targets, alpm_option_get_local_file_siglevel(config->handle));
>   	retval |= load_packages(fetched_files, alpm_option_get_remote_file_siglevel(config->handle));
>

Patch

diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c
index 0691856f..279609a4 100644
--- a/src/pacman/upgrade.c
+++ b/src/pacman/upgrade.c
@@ -99,7 +99,9 @@  int pacman_upgrade(alpm_list_t *targets)
 		goto fail_free;
 	}
 
-	printf(_("loading packages...\n"));
+	if(!config->print) {
+		printf(_("loading packages...\n"));
+	}
 	retval |= load_packages(local_targets, alpm_option_get_local_file_siglevel(config->handle));
 	retval |= load_packages(fetched_files, alpm_option_get_remote_file_siglevel(config->handle));