[pacman-dev] Restore usage line for -Fh

Message ID 20201125205311.19139-1-colin@fosskers.ca
State Accepted, archived
Headers show
Series [pacman-dev] Restore usage line for -Fh | expand

Commit Message

Colin Woodbury Nov. 25, 2020, 8:53 p.m. UTC
Unlike the other main commands, -F was missing its top-level usage line in its
help output.

Signed-off-by: Colin Woodbury <colin@fosskers.ca>
---
 src/pacman/pacman.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Allan McRae Nov. 26, 2020, 12:02 p.m. UTC | #1
On 26/11/20 6:53 am, Colin Woodbury wrote:
> Unlike the other main commands, -F was missing its top-level usage line in its
> help output.
> 
> Signed-off-by: Colin Woodbury <colin@fosskers.ca>
> ---
>  src/pacman/pacman.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
> index fefd3fa4..69e2e42a 100644
> --- a/src/pacman/pacman.c
> +++ b/src/pacman/pacman.c
> @@ -176,6 +176,8 @@ static void usage(int op, const char * const myname)
>  			printf("%s:  %s {-T --deptest} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
>  			printf("%s:\n", str_opt);
>  		} else if(op == PM_OP_FILES) {
> +			printf("%s:  %s {-F --files} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);

This gives:

usage:  pacman {-F --files} [options] [package(s)]

but "pacman -F" also takes file paths or regex as an argument, not just
package names.

> +			printf("%s:\n", str_opt);
>  			addlist(_("  -l, --list           list the files owned by the queried package\n"));
>  			addlist(_("  -q, --quiet          show less information for query and search\n"));
>  			addlist(_("  -x, --regex          enable searching using regular expressions\n"));
>
Colin Woodbury Nov. 26, 2020, 3:45 p.m. UTC | #2
> but "pacman -F" also takes file paths or regex as an argument, not just
> package names.

It does, yeah. In this case I was going off what `pacman -h` displays for `-F`, which is just `[packages]`. Should I update both `-h` and `-Fh`, or just the latter?

On Thu, 26 Nov 2020, at 04:02, Allan McRae wrote:
> On 26/11/20 6:53 am, Colin Woodbury wrote:
> > Unlike the other main commands, -F was missing its top-level usage line in its
> > help output.
> > 
> > Signed-off-by: Colin Woodbury <colin@fosskers.ca>
> > ---
> >  src/pacman/pacman.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
> > index fefd3fa4..69e2e42a 100644
> > --- a/src/pacman/pacman.c
> > +++ b/src/pacman/pacman.c
> > @@ -176,6 +176,8 @@ static void usage(int op, const char * const myname)
> >  printf("%s:  %s {-T --deptest} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
> >  printf("%s:\n", str_opt);
> >  } else if(op == PM_OP_FILES) {
> > + printf("%s:  %s {-F --files} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
> 
> This gives:
> 
> usage:  pacman {-F --files} [options] [package(s)]
> 
> but "pacman -F" also takes file paths or regex as an argument, not just
> package names.
> 
> > + printf("%s:\n", str_opt);
> >  addlist(_("  -l, --list           list the files owned by the queried package\n"));
> >  addlist(_("  -q, --quiet          show less information for query and search\n"));
> >  addlist(_("  -x, --regex          enable searching using regular expressions\n"));
> > 
>
Allan McRae Dec. 3, 2020, 11:38 a.m. UTC | #3
On 27/11/20 1:45 am, Colin Woodbury wrote:
>> but "pacman -F" also takes file paths or regex as an argument, not just
>> package names.
> 
> It does, yeah. In this case I was going off what `pacman -h` displays for `-F`, which is just `[packages]`. Should I update both `-h` and `-Fh`, or just the latter?
> 

You will see my patch on the list changing this to str_file as that is
(probably) the most common usage of -F.  I adjust this patch to do the
same and applied.

Allan

Patch

diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index fefd3fa4..69e2e42a 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -176,6 +176,8 @@  static void usage(int op, const char * const myname)
 			printf("%s:  %s {-T --deptest} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
 			printf("%s:\n", str_opt);
 		} else if(op == PM_OP_FILES) {
+			printf("%s:  %s {-F --files} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
+			printf("%s:\n", str_opt);
 			addlist(_("  -l, --list           list the files owned by the queried package\n"));
 			addlist(_("  -q, --quiet          show less information for query and search\n"));
 			addlist(_("  -x, --regex          enable searching using regular expressions\n"));