just icon indicating copy to clipboard operation
just copied to clipboard

Aliasing modules?

Open nxy7 opened this issue 1 year ago • 1 comments

I'm using module feature and I think it's great. One limitation that I've encountered is that modules cannot be aliased but it can be really useful in some scenarios.

mod frontend
mod backend

alias f := frontend

gives the following error

error: Alias `f` has an unknown target `frontend`
 ——▶ Justfile:4:7
  │
4 │ alias f := frontend
  │       ^

Not sure if it's planned or not.

nxy7 avatar Mar 07 '24 23:03 nxy7

I think this would be reasonable. It might be pretty rough in terms of implementation, but I definitely see the value of the feature.

casey avatar May 15 '24 01:05 casey

As the codebase evolves it's natural to move/rename commands. Aliasing modules is imho a great way to transition into another cmd layout. You can introduce changes without breaking all the functionality and muscle memory that depended on the previous state. Additionally, if we could mark something as "deprecated" then we could change say

# Foo 
mod foo 'path/to/module'

to

# Bar
mod bar 'path/to/module'

[deprecated="use just bar instead"]
alias foo := bar

And then

$ just foo run
Using `just foo` is deprecated: use just bar instead
...

lea-at-printr avatar Jun 27 '25 11:06 lea-at-printr