Improve --help text and add it to the README

This commit is contained in:
Michal Sojka 2024-09-15 14:08:07 +02:00
parent 20504c30f9
commit ca4c0e6bfc
3 changed files with 113 additions and 18 deletions

View file

@ -6,6 +6,67 @@ compatible with [nix-ros-overlay][].
This is work-in-progress. I'll add documentation after it works
reasonably well.
<!-- `$ python3 -m ros2nix --help` -->
```
usage: ros2nix [-h]
[--output OUTPUT | --output-as-ros-pkg-name | --output-as-nix-pkg-name]
[--output-dir OUTPUT_DIR] [--fetch] [--distro DISTRO]
[--src-param SRC_PARAM] [--source-root SOURCE_ROOT] [--flake]
[--nixfmt] [--copyright-holder COPYRIGHT_HOLDER]
[--license LICENSE]
source [source ...]
positional arguments:
source Path to package.xml
options:
-h, --help show this help message and exit
--output OUTPUT Output filename (default: package.nix)
--output-as-ros-pkg-name
Name output files based on ROS package name, e.g.,
package_name.nix. Implies --output-dir=. (default:
False)
--output-as-nix-pkg-name
Name output files based on Nix package name, e.g.,
package-name.nix. Implies --output-dir=. (default:
False)
--output-dir OUTPUT_DIR
Directory to generate output files in. By default,
package files are stored next to their corresponding
package.xml, top-level files like overlay.nix in the
current directory) (default: None)
--fetch Use fetches like fetchFromGitHub in src attribute
values. The fetch function and its parameters are
determined from the local git work tree. sourceRoot
attribute is set if needed and not overridden by
--source-root. (default: False)
--distro DISTRO ROS distro (used as a context for evaluation of
conditions in package.xml, in the name of the Nix
expression and in flake.nix). Note that the generated
Nix expression can be used with any ROS distro if its
package.xml contains no conditions. (default: rolling)
--src-param SRC_PARAM
Adds a parameter to the generated function and uses it
as a value of the src attribute (default: None)
--source-root SOURCE_ROOT
Set sourceRoot attribute value in the generated Nix
expression. Substring '{package_name}' gets replaced
with the package name. (default: None)
--flake Generate top-level flake.nix instead of default.nix.
Use with --fetch if some package.xml files are outside
of the flake repo. (default: False)
--nixfmt Format the resulting expressions with nixfmt (default:
False)
--copyright-holder COPYRIGHT_HOLDER
--license LICENSE License of the generated Nix expression, e.g. 'BSD'
(default: None)
```
[ROS]: https://www.ros.org/
[Nix]: https://nixos.org/
[nix-ros-overlay]: https://github.com/lopsided98/nix-ros-overlay
<!-- Local Variables: -->
<!-- compile-command: "mdsh" -->
<!-- End: -->