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

align target hints by column #1637

Closed
dmitry-mightydevops opened this issue May 8, 2024 · 1 comment · Fixed by #1656
Closed

align target hints by column #1637

dmitry-mightydevops opened this issue May 8, 2024 · 1 comment · Fixed by #1656
Labels
area: formatting Changes related to output and formatting. type: bug Something not working as intended.

Comments

@dmitry-mightydevops
Copy link

  • Task version:
➜ task --version
Task version: v3.36.0 (h1:XVJ5hQ5hdzTAulHpAGzbUMUuYr9MUOEQFOFazI3hUsY=)
  • Operating system:
➜ uname -a          
Linux dmitry-desktop 6.8.5-101.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Apr 11 19:59:26 UTC 2024 x86_64 GNU/Linux
  • Experiments enabled:
    N/A

Problem

image

would like to align the hints on the right side by the same column and remove unnecessary empty space lines between targets listed in the output

@task-bot task-bot added the state: needs triage Waiting to be triaged by a maintainer. label May 8, 2024
@dmitry-mightydevops
Copy link
Author

here is the taskfile

version: '3'

tasks:
  check-file-existence:
    desc: "Check if the specified file exists"
    vars:
      file: '{{.file}}'
    cmds:
      - test -f "{{.file}}" || (echo "The file {{.file}} does not exist" && exit 1)
    silent: true

  encrypt-string:
    desc: |
      Encrypt secret string with AWS KMS keys to be used in terraform, example: `task secrets:encrypt-string -- secret-text-here`
    vars:
      secret: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - |
        echo :OK"
    silent: true

  decrypt-string:
    desc: |
      Decrypt string with AWS KMS keys to be used in terraform, example: `task secrets:encrypt-string -- encrypted-text-here`
    vars:
      secret: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - |
        echo :OK"
    silent: true

  encrypt-file:
    desc: |
      Encrypt secret with AWS KMS keys to be used in terraform, example: `task secrets:encrypt-file -- apps/spiderkeeper/envs/prod.secrets.yaml`
    vars:
      file: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - task: check-file-existence
        vars: {file: "{{.file}}"}
      - |
        echo :OK"
    silent: true

  decrypt-file:
    desc: |
      Decrypt secret with AWS KMS keys to be used in terraform, example: `task secrets:decrypt-file -- apps/spiderkeeper/envs/prod.secrets.yaml.encrypted`
    vars:
      file: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - task: check-file-existence
        vars: {file: "{{.file}}"}
      - |
        echo :OK"
    silent: true

  edit-encrypted-file:
    desc: |
      Encrypt secret with AWS KMS keys to be used in terraform, example: `task secrets:edit-encrypted-file VAR=sentry_slack_webhook_url VAL=https://example.com -- ../secret.yaml.encrypted`
    vars:
      file: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV, VAR, VAL]
    cmds:
      - task: check-file-existence
        vars: {file: "{{.file}}"}
        output: decrypted_output
      - |
        echo :OK"
    silent: true

so if desc is multiline, i.e. this then the formatting is off

target:
  desc: |
    Then we have issues

If I change it to a single line

version: '3'

tasks:
  check-file-existence:
    desc: "Check if the specified file exists"
    vars:
      file: '{{.file}}'
    cmds:
      - test -f "{{.file}}" || (echo "The file {{.file}} does not exist" && exit 1)
    silent: true

  encrypt-string:
    desc: "Encrypt secret string with AWS KMS keys to be used in terraform, example: `task secrets:encrypt-string -- secret-text-here`"
    vars:
      secret: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - |
        echo :OK"
    silent: true

  decrypt-string:
    desc: "Decrypt string with AWS KMS keys to be used in terraform, example: `task secrets:encrypt-string -- encrypted-text-here`"
    vars:
      secret: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - |
        echo :OK"
    silent: true

  encrypt-file:
    desc: "Encrypt secret with AWS KMS keys to be used in terraform, example: `task secrets:encrypt-file -- apps/spiderkeeper/envs/prod.secrets.yaml`"
    vars:
      file: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - task: check-file-existence
        vars: {file: "{{.file}}"}
      - |
        echo :OK"
    silent: true

  decrypt-file:
    desc: "Decrypt secret with AWS KMS keys to be used in terraform, example: `task secrets:decrypt-file -- apps/spiderkeeper/envs/prod.secrets.yaml.encrypted`"
    vars:
      file: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV]
    cmds:
      - task: check-file-existence
        vars: {file: "{{.file}}"}
      - |
        echo :OK"
    silent: true

  edit-encrypted-file:
    desc: "Encrypt secret with AWS KMS keys to be used in terraform, example: `task secrets:edit-encrypted-file VAR=sentry_slack_webhook_url VAL=https://example.com -- ../secret.yaml.encrypted`"
    vars:
      file: '{{ index ($x:=splitArgs .CLI_ARGS) 0 }}'
    requires:
      vars: [ENV, VAR, VAL]
    cmds:
      - task: check-file-existence
        vars: {file: "{{.file}}"}
        output: decrypted_output
      - |
        echo :OK"
    silent: true

then all is good:

image

@pd93 pd93 added type: bug Something not working as intended. area: formatting Changes related to output and formatting. and removed state: needs triage Waiting to be triaged by a maintainer. labels May 8, 2024
@andreynering andreynering linked a pull request May 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: formatting Changes related to output and formatting. type: bug Something not working as intended.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants