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

Better aliasing for includes #1745

Closed
wants to merge 1 commit into from
Closed

Conversation

titpetric
Copy link

I want to import all the targets for an included taskfile into the current namespace.

includes:
  services:
    taskfile: Taskfile.services.yml
    aliases: [""]

The aliases feature exists, however when setting it to empty it still includes the :, making all of the alias still have the delimiter as the prefix. The change checks for an empty namespace, and removes a redundant sprintf call in the same function.

Before the change:

* services:build:       docker compose build                                       (aliases: :build)
* services:down:        docker compose down                                        (aliases: :down)
* services:logs:        docker compose logs etl -f                                 (aliases: :logs)
* services:mysql:       docker compose exec -it etl-db mysql -u etl -petl etl      (aliases: :mysql)
* services:up:          docker compose up -d --wait                                (aliases: :up)

After the change:

* services:build:       docker compose build                                       (aliases: build)
* services:down:        docker compose down                                        (aliases: down)
* services:logs:        docker compose logs etl -f                                 (aliases: logs)
* services:mysql:       docker compose exec -it etl-db mysql -u etl -petl etl      (aliases: mysql)
* services:up:          docker compose up -d --wait                                (aliases: up)

@Firesphere
Copy link

I was literally looking for a solution like this yesterday!

@pd93
Copy link
Member

pd93 commented Aug 9, 2024

I think flattening is the behavior you're looking for: #273, #1704

This has been long requested and is probably coming soon. I don't think alias is the right way to do this. In fact, we should probably raise an error when someone does alias: "".

@titpetric titpetric closed this Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants