Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow command imports #1258

Open
qjcg opened this issue Sep 15, 2021 · 3 comments
Open

Allow command imports #1258

qjcg opened this issue Sep 15, 2021 · 3 comments
Labels
FeatureRequest New feature or request tooling

Comments

@qjcg
Copy link

qjcg commented Sep 15, 2021

Is your feature request related to a problem? Please describe.
If I create a command in a _tool.cue file in one CUE package, I currently can't import and use that same command in another CUE package.

Describe the solution you'd like
I'd like to be able to use commands defined in _tool.cue files in more than one package.

For example, if I define an ls command in package foo, I'd like to be able to import and use the same ls command in package bar.

Describe alternatives you've considered
I've considered copying and pasting useful commands, but that's not DRY, and it's prone to command implementations "drifting" across packages.

Additional context
This seems related to #851.

Also, a note from Tony Worm via Slack:

The main problem to avoid is importing the tooling layer into the hermetic layer through a series of imports. This seems doable with enough bookkeeping & checks.

@qjcg qjcg added FeatureRequest New feature or request Triage Requires triage/attention labels Sep 15, 2021
@verdverm
Copy link

Note, you can define tasks with the $id field set correctly, without the tools/ import lines when defining. Put these in regular CUE files and you can then import them.

@mpvl
Copy link
Member

mpvl commented Mar 22, 2022

We plan to deprecate cue cmd and have cue run/cuerun instead, and doing some things better. One of the ideas here is to get rid of the special treatment of _tool.cue, which would make this all a lot easier.

In the end, as Tony alludes to, tool definitions are just CUE values that are interpreted by the tooling layer, so there is actually really no reason to treat them differently.

@qjcg
Copy link
Author

qjcg commented Mar 22, 2022

Thanks very much for your notes on the future story here Marcel! Really appreciate it and sounds great.

@rogpeppe rogpeppe removed the Triage Requires triage/attention label Apr 13, 2022
@mpvl mpvl added the tooling label Apr 13, 2022
@myitcv myitcv added the zGarden label Jun 13, 2023
@mvdan mvdan removed the zGarden label Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest New feature or request tooling
Projects
None yet
Development

No branches or pull requests

6 participants