From 7ded90ae6aaa34b403420de950f585adcc99163d Mon Sep 17 00:00:00 2001 From: Siteshwar Vashisht Date: Thu, 22 Mar 2012 23:41:36 +0530 Subject: [PATCH] Add trimmed descriptions with complete command while parsing man pages. --- create_manpage_completions.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/create_manpage_completions.py b/create_manpage_completions.py index f1e9d84f8..4f2f2685f 100755 --- a/create_manpage_completions.py +++ b/create_manpage_completions.py @@ -46,7 +46,7 @@ def printcompletecommand(cmdname, args, description): print "complete -c", cmdname, for arg in args: print arg, -# print "--descripton ", description + print "--descripton '" + description + "'" print "\n", def builtcommand(options, description): @@ -61,6 +61,13 @@ def builtcommand(options, description): else: optionlist[i] = "-s " + optionlist[i][1:] + first_period = description.find(".") +# print "First period at: ", first_period + if first_period >= 45 or first_period == -1 and len(description) > 45: + description = description[:45] + "... [See Man Page]" + elif first_period >= 0: + description = description[:first_period] + printcompletecommand(CMDNAME, optionlist, description)