Skip to content

Commit 4e3c842

Browse files
committed
Add help message for generate_doc.py
1 parent 5b82f7c commit 4e3c842

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

script/generate_doc.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,23 @@ def write_examples(destination_directory, example_directories, object_factory):
297297
file.write(python + '\n')
298298
file.write(' ```\n\n')
299299

300+
def print_help():
301+
print(f"Usage: {sys.argv[0]} [destination_directory] [example_directories...]")
302+
print("Description:")
303+
print(" This script generates markdown documentation for Sofa components from the Sofa object factory.")
304+
print("\nArguments:")
305+
print(" destination_directory: The directory where the generated markdown files will be written (default: the markdown directory in the parent of the parent of the current script)")
306+
print(" example_directories: Directories containing example XML files (optional)")
307+
print("\nExample:")
308+
print(f" python3 {sys.argv[0]} /path/to/markdown")
309+
print(f" python3 {sys.argv[0]} /path/to/markdown /path/to/examples1 /path/to/examples2")
310+
print("\nNote: The default destination directory is set to the 'markdown' directory in the parent of the parent of the current script.")
300311

301312
if __name__ == "__main__":
313+
if sys.argv[1] in ['-h', '--help']:
314+
print_help()
315+
sys.exit(0)
316+
302317
default_dest_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "markdown")
303318
destination_directory = sys.argv[1] if len(sys.argv) >= 2 else default_dest_dir
304319

0 commit comments

Comments
 (0)