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

Fish completion breaks if task description have colon (:) #2101

Open
ikura-hamu opened this issue Mar 7, 2025 · 0 comments
Open

Fish completion breaks if task description have colon (:) #2101

ikura-hamu opened this issue Mar 7, 2025 · 0 comments
Labels
area: completions Changes related to shell completions and scripts.

Comments

@ikura-hamu
Copy link

Description

Summary

The fish completion is broken when colon exists in task description.

Detail

When task descriptions contain colons (:), the fish shell completion breaks due to incorrect sed scripts. Additionally, sed behaves differently across environments, which further complicates the issue. By using fish scripts instead of sed, we can write more robust and maintainable completion scripts.

Environment:

  • Task version: v3.41.0
  • Fish version: v4.0.0
  • OS: Ubuntu 22.04

Steps to Reproduce

The issue can be reproduced using the following Taskfile.yml:

Taskfile.yml

version: "3"

tasks:
  command:
    desc: "description without a colon."

  colon:
    desc: "description with a colon: description with a colon."

  colon-s:
    desc: "description with a colon: and a following space."

  command:alias:
    desc: "description without a colon, but with aliases."
    aliases:
      - cma
      - cmda

  colon:alias:
    desc: "description with a colon: and aliases."
    aliases:
      - cla
      - clna

  colon-s:alias:
    desc: "description with a colon: a following space, and aliases."
    aliases:
      - clsa
      - clnsa

  no-desc:
    cmd: echo "no description."

  no-desc:alias:
    aliases:
      - nda
      - nda2

  "task with spaces: and a colon":
    desc: "description with spaces."

  "task and desc with spaces: and a colon":
    desc: "description with spaces: and a colon."


Before

Image

  • The completions for colon, colon:alias, colon-s, and colon-s:alias are broken.
  • task and desc with spaces: and a colon is also broken.

After

I attempted to fix the issue in my forked repository:
https://github.com/ikura-hamu/task

Image

  • The completions for colon, colon:alias, colon-s, and colon-s:alias now work correctly.
  • However, task and desc with spaces: and a colon is still broken.
  • Additionally, task with spaces: and a colon is now broken.

Discussion

I believe that tasks with both colons and spaces in their names are rare, as they are inconvenient to type and look somewhat messy in definitions. Therefore, my fix should work well for most users.

Would it be acceptable to merge this fix even though it does not fully resolve the issue for task names containing both spaces and colons? Or would you prefer a more comprehensive solution?

Version

3.41.0

Operating system

Ubuntu 22.04

Experiments Enabled

No response

Example Taskfile

version: "3"

tasks:
  command:
    desc: "description without a colon."

  colon:
    desc: "description with a colon: description with a colon."

  colon-s:
    desc: "description with a colon: and a following space."

  command:alias:
    desc: "description without a colon, but with aliases."
    aliases:
      - cma
      - cmda

  colon:alias:
    desc: "description with a colon: and aliases."
    aliases:
      - cla
      - clna

  colon-s:alias:
    desc: "description with a colon: a following space, and aliases."
    aliases:
      - clsa
      - clnsa

  no-desc:
    cmd: echo "no description."

  no-desc:alias:
    aliases:
      - nda
      - nda2

  "task with spaces: and a colon":
    desc: "description with spaces."

  "task and desc with spaces: and a colon":
    desc: "description with spaces: and a colon."
@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label Mar 7, 2025
@pd93 pd93 added area: completions Changes related to shell completions and scripts. and removed state: needs triage Waiting to be triaged by a maintainer. labels Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: completions Changes related to shell completions and scripts.
Projects
None yet
Development

No branches or pull requests

3 participants