[![Crates.io](https://img.shields.io/crates/v/ros_add.svg)](https://crates.io/crates/ros_add)
[![Docs](https://docs.rs/ros_add/badge.svg)](https://docs.rs/ros_add/latest/ros_add/)
[![Downloads](https://img.shields.io/crates/d/ros_add.svg)](https://crates.io/crates/ros_add)
[![Installs](https://img.shields.io/crates/d/ros_add?label=cargo%20installs)](https://crates.io/crates/ros_add)
[![License](https://img.shields.io/crates/l/cargo-make.svg)](https://gitlab.com/rust_projects3505446/ros_add/-/blob/ros_add/LICENSE?ref_type=heads)
[![Pipeline Status](https://gitlab.com/rust_projects3505446/ros_add/badges/ros_add/pipeline.svg)](https://gitlab.com/rust_projects3505446/ros_add/commits/rod_add)
[![Rust](https://img.shields.io/badge/rust-1.88.0%2B-orange.svg?maxAge=3600)](https://github.com/rust-lang/hashbrown)
# `cargo ros-add` - ROS Dependency Management Tool

[Cargo](https://doc.rust-lang.org/cargo/) subcommand for adding dependencies to [ROS](https://docs.ros.org/en/kilted/index.html) [Rust](https://www.rust-lang.org/) packages, handling both `package.xml` and `Cargo.toml` files automatically.

## Installation

```sh
cargo install ros-add
```

## Usage

```sh
cargo ros-add <dependency_name>
```

This will:
1. Add the dependency to your `package.xml` file
2. Attempt to add the dependency to `Cargo.toml` with a wildcard version (`*`)

## Features

- **Automatic [XML](https://en.wikipedia.org/wiki/XML) Handling**: Adds `depend` elements to `package.xml` while preserving formatting
- **Dual Configuration**: Updates both [ROS](https://docs.ros.org/en/kilted/index.html) (`package.xml`) and [Rust](https://www.rust-lang.org/) (`Cargo.toml`) dependency files
- **Idempotent Operation**: Won't duplicate existing dependencies
- **Error Handling**: Provides clear error messages for common issues

## Examples

Add a standard ROS dependency:
```sh
cargo ros-add roscpp
```

Add a custom ROS package dependency:
```sh
cargo ros-add my_custom_msgs
```

## Requirements

- Rust toolchain ([cargo](https://doc.rust-lang.org/cargo/))
- Existing ROS package with `package.xml` and `Cargo.toml` files

## Limitations

- Requires the package to have a valid `package.xml` file
- Supports all ros2 [`package.xml` format 3 dependency types](http://download.ros.org/schema/package_format3.xsd) like:
  * `build_depend`
  * `build_export_depend`
  * `buildtool_depend`
  * `buildtool_export_depend`
  * `exec_depend`
  * `depend`
  * `doc_depend`
  * `test_depend`
  * `conflict`
  * `replace`

## Contributing

Contributions are welcome! Please open an issue or pull request on [Gitlab](https://gitlab.com/rust_projects3505446/ros_add).

## License

[Apache-2.0](LICENSE)
