sdkman / sdkman-cli

The SDKMAN! Command Line Interface
https://sdkman.io
Apache License 2.0
6.07k stars 628 forks source link

sdkman should reject local version names which clash with available candidate names #685

Open hickst opened 5 years ago

hickst commented 5 years ago

Please tick one:

When creating a local version (i.e. adding/linking an existing local software installation) you must specify a unique version name for the local version. If you specify a version name which is already in sdkman's list of available candidates, sdkman does not link to the local installation but downloads and installs a new copy of the software.

It would be desirable if sdkman checked for and rejected local version names which clash with the names of available candidates.

marc0der commented 5 years ago

Reject reserved remote version names when performing local installation

andrebrait commented 5 years ago

What if it added suffixes or prefixes to local?

hickst commented 5 years ago

@andrebrait That's a nice idea. Since all versions seem to begin with a number, a suffix might work best. Perhaps the suffix (default -local?) could even be a configuration parameter somewhere (~/.sdkman/config?).

marc0der commented 5 years ago

I also like the idea of a suffix, but what to do about the 15 character limit?

I've got to admit that I don't really see the usefulness of making such a suffix configurable.

hickst commented 5 years ago

Oh darn....sorry: I didn't realize there was a 15 character limit (large version numbers could use up a lot of that (e.g., 11.10.101). Configurable is not that important and would only be useful if the character limit was larger: one might then choose a more descriptive suffix (e.g. -local or -myhostname).

marc0der commented 5 years ago

Also, don't know if you all realise but the list view already has an indicator for what is a local version. If you do an sdk ls java, you will see that local versions are marked as +. See the symbols at the bottom.

hickst commented 5 years ago

Right, but I interpreted André's suggestion to mean that instead of "rejecting reserved remote version names when performing a local installation", the program could automatically add a suffix to the name (to distinguish it as a local version). Given the 15 character limit on names, however, a suffix doesn't seem very practical.

marc0der commented 5 years ago

I suggest we do the simplest thing possible for now, that is show an error message and return a non-zero error code. wdyt?

Next steps we would need to write a spec for it. Would you like to help updating the specification @hickst?