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

cmd/cue: cue mod rename command #3626

Open
rogpeppe opened this issue Dec 13, 2024 · 0 comments
Open

cmd/cue: cue mod rename command #3626

rogpeppe opened this issue Dec 13, 2024 · 0 comments
Labels
FeatureRequest New feature or request modules Issues related to CUE modules and the experimental implementation

Comments

@rogpeppe
Copy link
Member

It's useful to be able to rename modules, particularly when bootstrapping new modules.
In particular, the module path chosen by cue mod init by default is arbitrary and should
not be used when publishing.

We propose a new command, cue mod rename which will automatically rename
the current module, and also rewrite import directives in source files that import packages from
the current module so that they use the new name.

Example usage test:

exec cue mod rename my.domain/q
cmp cue.mod/module.cue new/cue.mod/module.cue
cmp q.cue new/q.cue
cmp x/x.cue new/x/x.cue
cmp y/y.cue new/y/y.cue

-- cue.mod/module.cue --
module: "cue.example"

-- q.cue --
package q

q: 3
-- x/x.cue --
package x

import "cue.example/y"

x: y.y
-- y/y.cue --
package y

import "cue.example:q"
y: q.q

-- new/cue.mod/module.cue --
module: "my.domain/q"

-- new/q.cue --
package q

q: 3
-- new/x/x.cue --
package x

import "my.domain/q/y"

x: y.y
-- new/y/y.cue --
package y

import "my.domain/q"
y: q.q

For #3620

@rogpeppe rogpeppe added FeatureRequest New feature or request modules Issues related to CUE modules and the experimental implementation labels Dec 13, 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 modules Issues related to CUE modules and the experimental implementation
Projects
Status: Backlog
Development

No branches or pull requests

1 participant