tanka icon indicating copy to clipboard operation
tanka copied to clipboard

Support alternative syntax for specifying inline environment

Open tombrk opened this issue 4 years ago • 4 comments

Regular (static and single-inline) environments are specified like so:

tk show environments/default

Given environments/default/main.jsonnet returns multiple tanka.dev/Environment objects, the following is required:

tk show environments/default --name=myFancyEnv

While this usually works fine, it makes some automation much harder than needed. Previously this was possible:

for i in $(tk env list --names); do tk diff $i; done

This would have given you a diff of all environments. But it is impossible / unnecessarily hard to handle the flag case because we only know once it failed.


A solution to that would be to incorporate the name into the existing argument, maybe like so:

tk show environments/default:myFancyEnv

In return we could allow tk env list to return such strings, so above automation works again.

I propose to add that as an alternative way solely handled in the cmd/tk package for now. Given the feature is experimental anyawys, we can iterate on this further.

//cc @Duologic wdyt?

tombrk avatar Feb 26 '21 21:02 tombrk

I'm not opossed to it, most if not all use cases of looping over environments can be covered by tk env list --json imo. Is there a request or specific reason that pushes this idea forward?

Duologic avatar Feb 26 '21 21:02 Duologic

Only suggestion I can come up with: Maybe if we just replace --names with something like --identifiers to make it clear that it is not only representing the name.

Duologic avatar Feb 26 '21 21:02 Duologic

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 18 '21 23:04 stale[bot]

That doesn't seem related @James-Riordan, please move this to the discussions tab.

Duologic avatar Feb 06 '23 18:02 Duologic