Skip to content

Better aliasing for includes#1745

Closed
titpetric wants to merge 1 commit into
go-task:mainfrom
titpetric:aliases-trim
Closed

Better aliasing for includes#1745
titpetric wants to merge 1 commit into
go-task:mainfrom
titpetric:aliases-trim

Conversation

@titpetric

Copy link
Copy Markdown

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
Copy Markdown

I was literally looking for a solution like this yesterday!

@pd93

pd93 commented Aug 9, 2024

Copy link
Copy Markdown
Member

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