Skip to content

Add ability to filter tasks by namespace on --list and set a default filter #2089

@morganhein

Description

@morganhein

Description

Howdy Task!

I know namespaces exist, and I use them heavily, but it's not enough for my use case.

I use Task heavily in a monorepo. It now contains tasks for:

  1. developer interactions/bootstrapping
  2. pre-commit hook targets/entries
  3. github ci action steps
  4. dockerfile container creation

This has been really great for having re-usable, composable steps that are also user-discoverable.

However even with things namespaced, the user experience for 1 is not great when all the other tasks exist. If I lean into usin Task further, I can imagine 100+ tasks, and that's just useless when listing as a developer.

So for me, being able to set "categories" of visibility (on top of namespaces), being able to default that only a specific namespace gets displayed, or something, would be great.

What i'm proposing is something like:

default_visibility: development
tasks:
  up:
    desc: Starts up the docker compose environment for development
    visiblity_group: development
    cmds:
      - docker compose -f docker/docker-compose.yaml up -d

  down:
    desc: Stops the docker compose environment for development
    visiblity_group: development
    cmds:
      - docker compose -f docker/docker-compose.yaml down

  mocks:
    desc: Generate mocks for the firehose service
    visbility_group: ci
    cmds:
      - moq -out ./config_manager_mock.go ./ ConfigManager

Then, when listing, allow me to do something like task --group development or something.

For me, the real ask here is somehow hiding groups of tasks by default. I want Task to be the root/first place to look for all Tasks, regardless if it's a CI task or commonly used dev task. All tasks should be easily runnable by a user, without having to know which group/taskfile/etc it exists in. However for those that are just learning/discovering the code base, a simple task --list or analogous should present the user with the least amount of options possible, ideally with tasks that are more tailored to their experience.

Using namespaces, this still spits out a list that overfills the terminal, and overwhelms the user.

Another way might be able to default a certain namespace as the only one visible?

so a task --list would, by default, only show the dev: namespace, or something?

Either way, thanks for the awesome tool!

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: uiChanges related to the UI of Task.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions