add extra CLI commands to syskit - #566
Conversation
|
|
||
| desc "bundle_dir NAME", "print the directory of a bundle" | ||
| def bundle_dir(name) | ||
| require "rock/bundle" unless defined?(Rock::Bundles) | ||
|
|
||
| bundle = Rock::Bundles.each_bundle.find { |b| b.name == name } | ||
| if bundle | ||
| puts bundle.path | ||
| else | ||
| $stderr.puts "No bundle named '#{name}' found." | ||
| $stderr.puts "Available bundles are: #{Rock::Bundles.each_bundle.map(&:name).sort.join(', ')}" | ||
| exit 1 | ||
| end | ||
| end |
There was a problem hiding this comment.
This possibly exists in autoproj, or at least it is possible to get this information from an autoproj command (ie autoproj show bundles/bla)
There was a problem hiding this comment.
Yes, you can find packages with autoproj locate PACKAGE_NAME or with autoproj show PACKAGE_NAME as you said. But IMO it can be helpful to have this extra command, it is simple, easy to remember, and doesn't require autoproj. On the other hand, it doesn't bring any disadvantages
| desc "config ROBOT", "print the configuration of a given robot" | ||
| option :key, type: :string, repeatable: true, default: [] | ||
| option :from_bundle, type: :string, default: nil | ||
| def config(robot_name) |
There was a problem hiding this comment.
Typically, syskit is ran from the bundle itself. Besides that, I think a more useful command would to extract the variables inside the Conf variable from a syskit run, but that is way more complex (and might encounter friction if Conf is used as something dynamic).
I dont think that what you aimed for here should be packed with syskit, it can mostly be resolved by using a sequence of bash commands, and it is outside of syskit's scope
There was a problem hiding this comment.
I think a more useful command would to extract the variables inside the Conf variable from a syskit run, but that is way more complex (and might encounter friction if Conf is used as something dynamic).
I could also that, but I believe it should be a distinct command from this one. The current proposed syskit config command is designed to work without requiring the system to be running, which is nice to have. Otherwise, one would need to start the system to inspect the config files.
A part from the templated sdf generation use case we have in mind, this command could be useful for a quick inspection on the configuration of the system without needing to open all the files manually and read them, which is convenient.
Again, it doesn't bring any disadvantages adding support for this command.
syskit is ran from the bundle itself.
Yes, but for the templated SDF generation use case we dont run rock-gazebo necessarily from the robot bundle dir, we could run it from an arbitrary directory.
add
bundle-dircommand to syskit. This command returns the absolute path of a bundle.Usage example:
syskit bundle-dir my_bundleadd
syskit configto export a robot's configuration file.Usage example:
syskit config my_robot --from-bundle my_bundle --key parent_key.child_keyRelated to: rock-gazebo/simulation-rock_gazebo#70