gazebosim / gz-tools

Command line tools for the Gazebo libraries.
https://gazebosim.org
Apache License 2.0
15 stars 18 forks source link

--force-version could be more flexible #36

Closed chapulina closed 3 years ago

chapulina commented 3 years ago

The --force-version option only accepts a fully-qualified version, for example: --force-version 3.7.0. As a user, I often don't know what specific minor and patch versions I'm in, but I really care about what major version to use. It would be helpful if this flag were more flexible and would choose the best-fitting version based on a given major version.

It's also worth mentioning that it's not common to have multiple minor / patch versions of the same library available to the command line at the same time, so users will rarely want to choose a specific minor version.

caguero commented 3 years ago

Does it help to run --versions? I'm a bit hesitant to change the behavior of --force-version but we could add another option --force-major-version if needed.

scpeters commented 3 years ago

what if we add a new option called --force-exact-version that uses the current behavior, and then change --force-version to accept the most recent Patch if only Major.Minor are specified or the most recent minor if only the Major version is specified. I think it's ok to make a behavior change that relaxes the strictness, though it would be a breaking change to go in the reverse direction. That's my opinion

chapulina commented 3 years ago

Does it help to run --versions?

Yeah that's what I currently do, but it adds that extra step :grimacing: #lazy


The ideal behaviour I'd expect is that if I only provide the major version, it picks the highest available version within that major. For example:

$ ign topic --versions
9.1.0
9.0.0
8.2.0
10.0.0
# All these pick 9.1.0
ign topic --force-version 9
ign topic --force-version 9.1
ign topic --force-version 9.1.0

# These pick 9.0.0
ign topic --force-version 9.0
ign topic --force-version 9.0.0

So in my ideal world, we'd keep backwards compatibility and only have to memorize one argument.

caguero commented 3 years ago

Does it help to run --versions?

Yeah that's what I currently do, but it adds that extra step #lazy

The ideal behaviour I'd expect is that if I only provide the major version, it picks the highest available version within that major. For example:

$ ign topic --versions
9.1.0
9.0.0
8.2.0
10.0.0
# All these pick 9.1.0
ign topic --force-version 9
ign topic --force-version 9.1
ign topic --force-version 9.1.0

# These pick 9.0.0
ign topic --force-version 9.0
ign topic --force-version 9.0.0

So in my ideal world, we'd keep backwards compatibility and only have to memorize one argument.

I like this option! Thanks for the explanation and the brainstorming!

chapulina commented 3 years ago

For completeness, I should mention my ultimate dream, which is in https://github.com/ignitionrobotics/ign-tools/issues/9, i.e. ign topic --citadel :sweat_smile: