Open nandorholozsnyak opened 2 years ago
If I remember correctly, the desired behaviour is that locally defined catalogs are searched without needing to be qualified (ie no @name necessary).
Meaning that you can do jbang catalog add --name foo http://url/to/some/catalog
and then either use jbang analias@foo
or simply jbang analias
to run any alias in that catalog.
The same is not true for "implicit" catalogs, the ones that get added automatically when you run something like jbang hello@jbangdev
. (You can still get the same behaviour if you manually add that catalog using jbang catalog add
).
But it seems that behaviour is missing, as you've shown jbang analias
doesn't work anymore. So it's not jbang template/alias list
that's wrong it's run
and init
. So we have a regression.
@maxandersen can you confirm that this was indeed the desired behaviour?
If that is the desired workflow than okay, I thought the catalog's name should be appended behind it in the template list. I saw the tests you written, were they working?
Yeah so catalog "linked" in was meant to be available "via" it's hosted catalog.
I do not really understand it.
But, how would jbang handle the name collisions if two different catalogs are having the same template name? I
Order matters. First one wins.
Remember you can always use the explicit form.
Remember you can always use the explicit form.
What do you mean by using explicit form?
<template-name>@<catalog-name>
or
<template-name>@<user>/<repo>
To be honest if I would add one catalog to my local jbang-catalog, I would expect that it would give enough information for me about how to use a specific template (name@catalog-name), and for example if you have a tons of catalogs in with a tons of templates then it will be just a mess. I would say it is okay, right now my use cases and its templates are known by me, but for other newcomers they may not use it as easy we do.
Either works. Both are explicit.
The implicit one is
I'd go with the terms "qualified" vs "unqualified", where "qualified" means anything with a "@" in it, while "unqualified" means something that a simple name, like "foo", "myscript", "test123", etc.
Okay cool, but as I said, I would be happy to see the "qualified" names in the template list output if a given templates is coming from an external catalog :D But if the use cases, expectations are not that in case of this feature, then I understand it and we can close it.
I think we can at least do better than we do now in giving the user a good idea of what aliases are available and how to run them. I'm working on a PR for this so definitely don't close this 🙂
Describe the bug Template catalog names when templates are being listed only being resolved from the implicit catalog, that only gets populated if (of course there are other possible methods, I recognized one) the
jbang init
with a template references a repository that has not been used earlier.To Reproduce Here are a few steps to reproduce it: First step - add this catalog https://github.com/nandorholozsnyak/jbang-cloud/blob/main/jbang-catalog.json
$ jbang catalog add --name cloud https://github.com/nandorholozsnyak/jbang-cloud/blob/main/jbang-catalog.json [jbang] Catalog 'cloud' added to '/home/nandorholozsnyak/.jbang/jbang-catalog.json'
Second step - List the templates and validate that the templates from the earlier mentioned catalog are not being marked as coming from the cloud catalog as it was added.For example q-aws-lambda should be q-aws-lambda@cloud. If now we would try the
jbang init -t=q-aws-lambda Lambda.java
it will not work, but withjbang init -t=q-aws-lambda@cloud Lambda.java
it would as it was mentioned.Third step (if we want to FIX the naming but it would not name it as we want) - at this time the implicit-catalog.json is still empty, and the catalog name for templates are coming from this file, with a trick.
As a third step lets try to init with the following key q-aws-lambda@nandorholozsnyak/jbang-cloud.
In this case the content of the implicit-catalog.json is the following
With that we would say, cool the catalog's name should be resolved when the templates are being listed, but not. In my local jbang-catalog.json the URL for the catalog is the following: https://github.com/nandorholozsnyak/jbang-cloud/blob/main/jbang-catalog.json but in the implicit-catalog.json we have this: https://github.com/nandorholozsnyak/jbang-cloud/blob/HEAD/jbang-catalog.json
The difference is the main <-> HEAD.
For fixing it we either have to change the catalog's ref in the jbang-catalog.json or we have to make a new init with the following key:
-t=q-aws-lambda@nandorholozsnyak/jbang-cloud/main
The content of the implicit-catalog.json is the following:
And with the
jbang template list
the output is the followingWhat I think would be good to see is the following
Because the following commands works like charm if the jbang-catalog.json has the catalog entry cloud:
Expected behavior Show catalog's name after the template as shown above.
JBang version 0.90.1