Better handling of important options
- Better detection of the data types constraints for options with *
This commit is contained in:
parent
af5e408335
commit
fe4f0f6e6b
|
|
@ -77,14 +77,15 @@ def document(sentences, **kw):
|
||||||
# Reuse the s.value Str
|
# Reuse the s.value Str
|
||||||
help_str = s.value
|
help_str = s.value
|
||||||
doc_str = s.value.s.rstrip()
|
doc_str = s.value.s.rstrip()
|
||||||
if type_hint and (doc_str.startswith(' [string') or doc_str.startswith(' [number') or
|
doc_str_2 = ' '+doc_str[2:] if doc_str.startswith(' *') else doc_str
|
||||||
doc_str.startswith(' [boolean')):
|
if type_hint and (doc_str_2.startswith(' [string') or doc_str_2.startswith(' [number') or
|
||||||
|
doc_str_2.startswith(' [boolean')):
|
||||||
# Hardcoded type hint, don't add one
|
# Hardcoded type hint, don't add one
|
||||||
type_hint = ''
|
type_hint = ''
|
||||||
# The * marks this option as a basic (not advanced) option
|
# The * marks this option as a basic (not advanced) option
|
||||||
if doc_str.startswith(' *') and type_hint:
|
if doc_str.startswith(' *') and type_hint:
|
||||||
# Move the marker to the beginning
|
# Move the marker to the beginning
|
||||||
doc_str = ' '+doc_str[2:]
|
doc_str = doc_str_2
|
||||||
type_hint = '*'+type_hint
|
type_hint = '*'+type_hint
|
||||||
help_str.s = type_hint+doc_str+post_hint
|
help_str.s = type_hint+doc_str+post_hint
|
||||||
sentences[n] = Assign(targets=[target], value=help_str)
|
sentences[n] = Assign(targets=[target], value=help_str)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue