1
0
mirror of https://github.com/go-task/task.git synced 2025-07-17 01:43:07 +02:00
Go to file
Henrique Corrêa 0e23404d23 feat: specify --init filename/path (#2018)
* feat: specify init filename with --taskfile flag

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.

* docs: update CLI reference

* fix Flags header being inside tip admonition
* change -t flag's default column and add a description
* add Default Filenames section

* docs: revert adding Default Filenames section

I didn't realize it already existed elsewhere.

* refactor: use path instead of filepath on InitTaskFile

as requested to prevent ambiguity with the stdlib package.

* fix TestInit (incorrectly merged)

* docs: remove outdated info on --taskfile flag

* refactor task initialization changes

- 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

* print colon instead of "at"

it's a lot cleaner in most cases.

* rewrite init tests

test both initializing to a directory path and a file path

* return final path from InitTaskfile

...and print it's relative representation

* fix lint error (ineffassign)

* use filepathext.TryAbsToRel() instead

* define and use filepathext.IsExtOnly()

* link to default filenames list in cli ref docs

(specifically in the --taskfile flag description)
2025-02-10 11:22:49 +00:00
2025-01-25 09:14:26 +01:00
2025-02-08 23:16:41 +00:00
2024-09-02 19:21:53 +00:00
2024-08-14 08:37:05 -05:00
2024-08-14 08:37:05 -05:00
2017-02-28 09:15:25 -03:00
2025-01-18 11:15:57 -03:00
2025-01-18 11:15:57 -03:00
2025-01-18 10:11:00 -03:00

Task

Task is a task runner / build tool that aims to be simpler and easier to use than, for example, GNU Make.

Installation | Documentation | Twitter | Bluesky | Mastodon | Discord

Gold Sponsors

Description
A task runner / simpler Make alternative written in Go
https://taskfile.dev/ Readme MIT 30 MiB
Languages
Go 91%
Shell 5.1%
TypeScript 1.5%
CSS 1%
JavaScript 1%
Other 0.4%