[pacman-dev] Add NoProgressbar to pacman.conf options

Message ID 20200407204423.51263-1-escondida@iff.ink
State Changes Requested
Headers show
Series [pacman-dev] Add NoProgressbar to pacman.conf options | expand

Commit Message

Ivy Foster April 7, 2020, 8:44 p.m. UTC
From: Ivy Foster <escondida@iff.ink>

Signed-off-by: Ivy Foster <escondida@iff.ink>
---
 doc/pacman.conf.5.asciidoc | 3 +++
 etc/pacman.conf.in         | 1 +
 src/pacman/conf.c          | 2 ++
 src/pacman/pacman-conf.c   | 3 +++
 4 files changed, 9 insertions(+)

--
2.26.0

Comments

Allan McRae April 13, 2020, 1:53 p.m. UTC | #1
On 8/4/20 6:44 am, escondida@iff.ink wrote:
> From: Ivy Foster <escondida@iff.ink>
> 

This patch looks fine.

Only changes:

NoProgressbar -> NoProgressBar  - there are three words there

Similarly for "progressbar" in the documentation.  Make that two works.


But I am missing the justification for this option.  I can understand
the command line option if you are capturing the output, but why would
this need to be added permanently.

IT is a tiny patch that has little footprint, so happy to include.  I'd
just like some justification!

> Signed-off-by: Ivy Foster <escondida@iff.ink>
> ---
>  doc/pacman.conf.5.asciidoc | 3 +++
>  etc/pacman.conf.in         | 1 +
>  src/pacman/conf.c          | 2 ++
>  src/pacman/pacman-conf.c   | 3 +++
>  4 files changed, 9 insertions(+)
> 
> diff --git a/doc/pacman.conf.5.asciidoc b/doc/pacman.conf.5.asciidoc
> index b297e332..73f57eeb 100644
> --- a/doc/pacman.conf.5.asciidoc
> +++ b/doc/pacman.conf.5.asciidoc
> @@ -186,6 +186,9 @@ Options
>  *Color*::
>  	Automatically enable colors only when pacman's output is on a tty.
> 
> +*NoProgressbar*::
> +	Disables progressbars. 
> +
>  *TotalDownload*::
>  	When downloading, display the amount downloaded, download rate, ETA,
>  	and completed percentage of the entire download list rather
> diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in
> index 7446944f..fb473fe9 100644
> --- a/etc/pacman.conf.in
> +++ b/etc/pacman.conf.in
> @@ -31,6 +31,7 @@ Architecture = auto
>  # Misc options
>  #UseSyslog
>  #Color
> +#NoProgressbar
>  #TotalDownload
>  CheckSpace
>  #VerbosePkgLists
> diff --git a/src/pacman/conf.c b/src/pacman/conf.c
> index f9de386f..92614860 100644
> --- a/src/pacman/conf.c
> +++ b/src/pacman/conf.c
> @@ -579,6 +579,8 @@ static int _parse_options(const char *key, char *value,
>  				config->color = isatty(fileno(stdout)) ? PM_COLOR_ON : PM_COLOR_OFF;
>  				enable_colors(config->color);
>  			}
> +		} else if(strcmp(key, "NoProgressbar") == 0) {
> +			config->noprogressbar = 1;
>  		} else if(strcmp(key, "DisableDownloadTimeout") == 0) {
>  			config->disable_dl_timeout = 1;
>  		} else {
> diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c
> index 6e25d243..48152697 100644
> --- a/src/pacman/pacman-conf.c
> +++ b/src/pacman/pacman-conf.c
> @@ -259,6 +259,7 @@ static void dump_config(void)
>  	show_bool("VerbosePkgLists", config->verbosepkglists);
>  	show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
>  	show_bool("ILoveCandy", config->chomp);
> +	show_bool("NoProgressbar", config->noprogressbar);
> 
>  	show_cleanmethod("CleanMethod", config->cleanmethod);
> 
> @@ -368,6 +369,8 @@ static int list_directives(void)
>  			show_bool("VerbosePkgLists", config->verbosepkglists);
>  		} else if(strcasecmp(i->data, "DisableDownloadTimeout") == 0) {
>  			show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
> +		} else if(strcasecmp(i->data, "NoProgressbar") == 0) {
> +			show_bool("NoProgressbar", config->noprogressbar);
> 
>  		} else if(strcasecmp(i->data, "CleanMethod") == 0) {
>  			show_cleanmethod("CleanMethod", config->cleanmethod);
> --
> 2.26.0
> .
>
Allan McRae April 13, 2020, 2:01 p.m. UTC | #2
On 13/4/20 11:53 pm, Allan McRae wrote:
> On 8/4/20 6:44 am, escondida@iff.ink wrote:
>> From: Ivy Foster <escondida@iff.ink>
>>
> 
> This patch looks fine.
> 
> Only changes:
> 
> NoProgressbar -> NoProgressBar  - there are three words there
> 
> Similarly for "progressbar" in the documentation.  Make that two works.
> 
> 
> But I am missing the justification for this option.  I can understand
> the command line option if you are capturing the output, but why would
> this need to be added permanently.
> 
> IT is a tiny patch that has little footprint, so happy to include.  I'd
> just like some justification!
> 

OK - I have been informed this is for people with crappy terminals.  The
description in the pacman.conf man page should add some detail.  e.g.

Disable progress bars.  Useful for terminals that do not support all
needed escape characters.

Allan

Patch

diff --git a/doc/pacman.conf.5.asciidoc b/doc/pacman.conf.5.asciidoc
index b297e332..73f57eeb 100644
--- a/doc/pacman.conf.5.asciidoc
+++ b/doc/pacman.conf.5.asciidoc
@@ -186,6 +186,9 @@  Options
 *Color*::
 	Automatically enable colors only when pacman's output is on a tty.

+*NoProgressbar*::
+	Disables progressbars.
+
 *TotalDownload*::
 	When downloading, display the amount downloaded, download rate, ETA,
 	and completed percentage of the entire download list rather
diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in
index 7446944f..fb473fe9 100644
--- a/etc/pacman.conf.in
+++ b/etc/pacman.conf.in
@@ -31,6 +31,7 @@  Architecture = auto
 # Misc options
 #UseSyslog
 #Color
+#NoProgressbar
 #TotalDownload
 CheckSpace
 #VerbosePkgLists
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index f9de386f..92614860 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -579,6 +579,8 @@  static int _parse_options(const char *key, char *value,
 				config->color = isatty(fileno(stdout)) ? PM_COLOR_ON : PM_COLOR_OFF;
 				enable_colors(config->color);
 			}
+		} else if(strcmp(key, "NoProgressbar") == 0) {
+			config->noprogressbar = 1;
 		} else if(strcmp(key, "DisableDownloadTimeout") == 0) {
 			config->disable_dl_timeout = 1;
 		} else {
diff --git a/src/pacman/pacman-conf.c b/src/pacman/pacman-conf.c
index 6e25d243..48152697 100644
--- a/src/pacman/pacman-conf.c
+++ b/src/pacman/pacman-conf.c
@@ -259,6 +259,7 @@  static void dump_config(void)
 	show_bool("VerbosePkgLists", config->verbosepkglists);
 	show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
 	show_bool("ILoveCandy", config->chomp);
+	show_bool("NoProgressbar", config->noprogressbar);

 	show_cleanmethod("CleanMethod", config->cleanmethod);

@@ -368,6 +369,8 @@  static int list_directives(void)
 			show_bool("VerbosePkgLists", config->verbosepkglists);
 		} else if(strcasecmp(i->data, "DisableDownloadTimeout") == 0) {
 			show_bool("DisableDownloadTimeout", config->disable_dl_timeout);
+		} else if(strcasecmp(i->data, "NoProgressbar") == 0) {
+			show_bool("NoProgressbar", config->noprogressbar);

 		} else if(strcasecmp(i->data, "CleanMethod") == 0) {
 			show_cleanmethod("CleanMethod", config->cleanmethod);