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

Make Taskfile initialization less verbose by default #2011

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HeCorr
Copy link
Contributor

@HeCorr HeCorr commented Jan 22, 2025

Fixes #2009.

When using the --init flag to create a new Taskfile, it currently prints the whole contents of the file to the terminal, which is unnecessarily verbose (and honestly seems to be unintentional).

This PR fixes it by only printing the filename by default and taking the --silent and --verbose flags into account to control the behavior:

$ task --init
Taskfile.yml created in the current directory
$ task --init --silent
$ task --init --verbose
# https://taskfile.dev

version: '3'

vars:
  GREETING: Hello, World!

tasks:
  default:
    cmds:
      - echo "{{.GREETING}}"
    silent: true

Taskfile.yml created in the current directory

Please note that I purposefully did not update the description of the --silent and --verbose flags so please let me know if you want me to and what should I change them to.

When using --init to create a new Taskfile, it used to print the whole contents of the file to the terminal, which was unnecessarily verbose (and honestly felt unintentional).

Now only the filename is printed by default and the --silent and --verbose flags can be used to control the behavior (print nothing or content + filename, respectively).
it looks slightly better in the terminal.
@HeCorr
Copy link
Contributor Author

HeCorr commented Jan 22, 2025

I'm considering making the Taskfile.yml created in the current directory text green to differentiate it from the file content output if it is present. Thoughts?

Copy link
Member

@pd93 pd93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like this :) Changes seem fine to me. I don't think there is a huge need to update the flag descriptions for this. It should be fairly intuitive.

I do think we could update the Usage > Getting Started section to talk about --init though. We don't mention it anywhere on that page, despite being an intended starting point.

Not fussed if we do this here or in a separate PR.

@HeCorr
Copy link
Contributor Author

HeCorr commented Jan 24, 2025

We don't mention it anywhere on that page, despite being an intended starting point.

I did notice that and fully agree! I wouldn't really know how to write it though, so I prefer to leave it up to you guys.

@pd93
Copy link
Member

pd93 commented Jan 24, 2025

No problem. I'm happy to add this later. Waiting for a second maintainer to review before we merge.

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.

Taskfile initialization is too verbose
2 participants