diff --git a/scripts/build-declarations.js b/scripts/build-declarations.js index a9846fe..88a6b97 100755 --- a/scripts/build-declarations.js +++ b/scripts/build-declarations.js @@ -10,11 +10,13 @@ function main() { const isTool = path.dirname(scriptfile) == "tools"; const contents = fs.readFileSync(process.argv[2], "utf8"); const functions = extractFunctions(contents, isTool); - let declarations = functions.map(({ funcName, jsdoc }) => { + let declarations = []; + for (const { funcName, jsdoc } of functions) { const { description, params } = parseJsDoc(jsdoc, funcName); + if (!description) continue; const declaration = buildDeclaration(funcName, description, params); - return declaration; - }); + declarations.push(declaration); + } if (isTool) { const name = getBasename(scriptfile); if (declarations.length > 0) { diff --git a/scripts/build-declarations.py b/scripts/build-declarations.py index 72b6aff..3b70e8d 100755 --- a/scripts/build-declarations.py +++ b/scripts/build-declarations.py @@ -22,6 +22,8 @@ def main(is_tool=True): for function in functions: func_name, docstring, func_args = function description, params = parse_docstring(docstring) + if not description: + continue declarations.append( build_declaration(func_name, description, params, func_args) ) @@ -42,10 +44,10 @@ def extract_functions(contents: str, is_tool: bool): if not isinstance(node, ast.FunctionDef): continue func_name = node.name - if func_name.startswith("_"): - continue if is_tool and func_name != TOOL_ENTRY_FUNC: continue + if func_name.startswith("_"): + continue docstring = ast.get_docstring(node) or "" func_args = OrderedDict() for arg in node.args.args: diff --git a/scripts/build-declarations.sh b/scripts/build-declarations.sh index f01ad7d..af23590 100755 --- a/scripts/build-declarations.sh +++ b/scripts/build-declarations.sh @@ -59,7 +59,7 @@ build_declarations() { parameters: parse_parameter([.flag_options[] | select(.id != "help" and .id != "version")]) }; [ - .[] | parse_declaration | select(.name | startswith("_") | not) + .[] | parse_declaration | select(.name | startswith("_") | not) | select(.description != "") ]' }