[PATCH] param: get "name" from this->name rather than this->ptype->name

Skip to first unread message

Konstantin Kharlamov

Jan 12, 2021, 2:02:20 AMJan 12
to klis...@googlegroups.com
From: Konstantin Kharlamov <k.kha...@npobaum.ru>

The difference between the two is that ptype->name has help text. As
result, the help->name and help->help has the same text, which is
unhelpful. It results in help text that looked like the following:

Group name Group name

Fix this by using the this->name instead, which is the actual name. This
makes the example above to look like this instead:

name Group name

Signed-off-by: Konstantin Kharlamov <k.kha...@npobaum.ru>
clish/param/param.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/clish/param/param.c b/clish/param/param.c
index ddaa51a..8f1a945 100644
--- a/clish/param/param.c
+++ b/clish/param/param.c
@@ -106,11 +106,9 @@ void clish_param_help(const clish_param_t * this, clish_help_t *help)

- if (CLISH_PARAM_SUBCOMMAND == clish_param__get_mode(this))
- name = clish_param__get_value(this);
- else
- if (!(name = clish_ptype__get_text(this->ptype)))
- name = clish_ptype__get_name(this->ptype);
+ name = (CLISH_PARAM_SUBCOMMAND == clish_param__get_mode(this))
+ ? clish_param__get_value(this)
+ : clish_param__get_name(this);

lub_string_cat(&str, this->text);
if (range) {

Serj Kalichev

Jan 18, 2021, 4:43:56 AMJan 18
to klis...@googlegroups.com
I doubt that it's good change.
PARAM has own help text.
In a pair like "Group name    Group name" the first "Group name" text is
a PTYPE's help but second "Group name" text is a PARAM's help. It's
supposed that real help for parameter is PARAM's help. PTYPE's help can
be description or name of parameter (with such PTYPE) like a "name".

PRAM's name generally is internal "variable" name. It's not for user

12.01.2021 10:02, Konstantin Kharlamov пишет:


Jan 20, 2021, 3:51:03 AMJan 20
to klis...@googlegroups.com
Thank you, I'll look at it
> --
> You received this message because you are subscribed to the Google Groups "klish-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to klish-dev+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/klish-dev/2b27e7f4-3983-21b2-ab7c-fd7becf577b7%40gmail.com.
Reply all
Reply to author
0 new messages