On Thu, Feb 24, 2022 at 9:28 AM HAGIO KAZUHITO(萩尾 一仁) <k-hagio-ab@nec.com> wrote:
-----Original Message-----
> Sometimes, the sys command may be misused, but it doesn't display
> the expected help information, for example:
>
> Without the patch:
> crash> sys kmem
> NAME
>   kmem - kernel memory
> SYNOPSIS
>   kmem [-f|-F|-c|-C|-i|-v|-V|-n|-z|-o|-h] [-p | -m member[,member]]
>        [[-s|-S|-S=cpu[s]|-r] [slab] [-I slab[,slab]]] [-g [flags]] [[-P] address]]
> ...
> crash> sys abc
> crash>

Just my preference for readability, to distinguish prompt and output from
others, could you add spaces at the beginning of the lines like this?

Without the patch:
  crash> sys kmem
  NAME
    kmem - kernel memory
^^


Good suggestion, thank you for the review, Kazu.

I will add spaces for them when merging.

Lianbo
 
Otherwise, looks good.  Thank you for the fix.

Acked-by: Kazuhito Hagio <k-hagio-ab@nec.com>

Kazu

>
> With the patch:
> crash> sys kmem
> Usage:
>   sys [-c [name|number]] [-t] [-i] config
> Enter "help sys" for details.
> crash> sys abc
> Usage:
>   sys [-c [name|number]] [-t] [-i] config
> Enter "help sys" for details.
>
> Signed-off-by: Lianbo Jiang <lijiang@redhat.com>
> ---
>  kernel.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel.c b/kernel.c
> index 9c4aabffe580..1c6344735299 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -5476,7 +5476,7 @@ cmd_sys(void)
>               else if (STREQ(args[optind], "config"))
>                       read_in_kernel_config(IKCFG_READ);
>                  else
> -                        cmd_usage(args[optind], COMPLETE_HELP);
> +                        cmd_usage(pc->curcmd, SYNOPSIS);
>                  optind++;
>          } while (args[optind]);
>  }
> --
> 2.20.1