diff --git a/CHANGELOG b/CHANGELOG index bbfa8a3..78e188a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/). --- +## [0.1.10] - 2025-08-20 + +### Added +- Add a default plugin directory in case nothing is passed + ## [0.1.9] - 2025-08-12 ### Added diff --git a/package-lock.json b/package-lock.json index b30455b..e06412b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "launchmap", - "version": "0.1.9", + "version": "0.1.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "launchmap", - "version": "0.1.9", + "version": "0.1.10", "license": "Apache-2.0", "dependencies": { "which": "^5.0.0" diff --git a/package.json b/package.json index f78299b..315385a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "launchmap", "displayName": "LaunchMap", "description": "Visualize ROS2 Launch Files", - "version": "0.1.9", + "version": "0.1.10", "publisher": "kodorobotics", "icon": "assets/launchmap-logo.png", "bugs": { diff --git a/parse.py b/parse.py index e3d8fe8..23b51d8 100644 --- a/parse.py +++ b/parse.py @@ -12,23 +12,26 @@ # See the License for the specific language governing permissions and # limitations under the License. +import os import sys import json import argparse from parser.entrypoint.user_interface import parse_and_format_launch_file from parser.plugin_loader import load_user_handlers_from_directory +DEFAULT_PLUGIN_DIR = os.path.join(os.path.dirname(__file__), "parser", "custom_handler") def main(): parser = argparse.ArgumentParser(description="Parse a ROS2 launch file.") parser.add_argument("launch_file", help="Path to launch file to parse.") parser.add_argument( - "--plugin-dir", help="Directory containing user-defined custom handlers." + "--plugin-dir", help="Directory containing user-defined custom handlers.", + default = DEFAULT_PLUGIN_DIR ) args = parser.parse_args() - if args.plugin_dir: + if os.path.isdir(args.plugin_dir): load_user_handlers_from_directory(args.plugin_dir) try: diff --git a/parser/tests/real_cases/launch_files/custom_handlers/launch_config_as_bool_handler.py b/parser/custom_handlers/launch_config_as_bool_handler.py similarity index 100% rename from parser/tests/real_cases/launch_files/custom_handlers/launch_config_as_bool_handler.py rename to parser/custom_handlers/launch_config_as_bool_handler.py diff --git a/parser/tests/real_cases/launch_files/custom_handlers/rewritten_yaml_handler.py b/parser/custom_handlers/rewritten_yaml_handler.py similarity index 100% rename from parser/tests/real_cases/launch_files/custom_handlers/rewritten_yaml_handler.py rename to parser/custom_handlers/rewritten_yaml_handler.py diff --git a/parser/tests/real_cases/launch_files/.launchmap b/parser/tests/real_cases/launch_files/.launchmap index bb01296..1888526 100644 --- a/parser/tests/real_cases/launch_files/.launchmap +++ b/parser/tests/real_cases/launch_files/.launchmap @@ -1,3 +1,3 @@ { - "pluginDir": "/Users/sakshaymahna/Documents/Robotics/ROSDocker/launchmap/parser/tests/real_cases/launch_files/custom_handlers" + "pluginDir": "/Users/sakshaymahna/Documents/Robotics/ROSDocker/launchmap/parser/custom_handlers" } \ No newline at end of file diff --git a/parser/tests/test_real_launch_files.py b/parser/tests/test_real_launch_files.py index 6a9a841..04a5d1f 100644 --- a/parser/tests/test_real_launch_files.py +++ b/parser/tests/test_real_launch_files.py @@ -23,7 +23,7 @@ BASE_DIR = os.path.dirname(__file__) INPUT_DIR = os.path.join(BASE_DIR, "real_cases/launch_files") OUTPUT_DIR = os.path.join(BASE_DIR, "real_cases/expected_outputs") -PLUGIN_DIR = os.path.join(BASE_DIR, "real_cases/launch_files/custom_handlers") +PLUGIN_DIR = os.path.join(BASE_DIR, "../custom_handlers") @pytest.mark.parametrize("filename", [f for f in os.listdir(INPUT_DIR) if f.endswith(".py")])