-
-
Notifications
You must be signed in to change notification settings - Fork 641
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
feat: specify --init filename/path #2018
base: main
Are you sure you want to change the base?
Conversation
previously, it was not possible to specify which filename to use when initializing a new Taskfile as it was hardcoded as "Taskfile.yml". now the --taskfile flag specifies where to write the file to, and the first * contained in it will be replaced by "Taskfile", so `task -it *.yaml` will create a `Taskfile.yaml` file.
* fix Flags header being inside tip admonition * change -t flag's default column and add a description * add Default Filenames section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this! Generally supportive of this improvement. Just a couple of discussion points on the implementation/docs.
I didn't realize it already existed elsewhere.
as requested to prevent ambiguity with the stdlib package.
This comment was marked as resolved.
This comment was marked as resolved.
It didn't. It fails because, previously in the test, we passed the directory containing the Taskfile as the second parameter, and we concatenated the filename in the (see : Line 23 in 23df1f0
|
oh, oops. I must have messed up the merge then. thanks. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
- remove const DefaultTaskInitFilename from taskfile/taskfile.go - revert description of Entrypoint flag - make InitTaskfile accept a path to either a file or a directory, and join the default Taskfile name+ext to it if it is a directory - take the target file path from the first argument instead of the Entrypoint flag - detect extension-only filenames (".yaml") instead of replacing "*" with "Taskfile" - use different format in success log so that it makes sense at different paths than the current dir
it's a lot cleaner in most cases.
Refactor complete, main post updated, manual tests passing, ready to remove Draft status. Tested commands:
|
test both initializing to a directory path and a file path
...and print it's relative representation
Modified Only a small quirk with the current implementation which prints the path relative to the current dir is that this may be printed depending on the input path:
...but it is generally much shorter:
|
(specifically in the --taskfile flag description)
Updated the docs one last time as well as the original PR message. |
Closes #2008.
Task currently does not provide a way to specify which filename to use when initializing a file (hardcoded as
Taskfile.yml
), forcing users to rename the file/extension after creation.This PR fixes that by taking the target filename from the first non-flag argument:
If a path with no name (extension only) is provided, the default name "Taskfile" is prepended to it:
Different directories are also supported:
This PR also includes the following updates to the docs:
Flags
header being inside the Tip admonition in CLI Reference page:--taskfile
flag information: