Implement Init and fix setting build variables #26

Merged
brianmcgee merged 2 commits from feat/init into main 2024-02-28 09:19:37 +00:00
Member
No description provided.
brianmcgee added 2 commits 2024-02-23 11:54:20 +00:00
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Signed-off-by: Brian McGee <brian@bmcgee.ie>
brianmcgee requested review from zimbatm 2024-02-23 11:54:26 +00:00
zimbatm approved these changes 2024-02-24 09:25:13 +00:00
main.go Outdated
@ -24,0 +30,4 @@
// For the same reasons above we implement init like this
for _, arg := range os.Args {
if arg == "--init" || arg == "-i" {
if err := os.WriteFile("treefmt.toml", initBytes, 0o644); err != nil {

you can use path.join(WorkingDirectory, ConfigFile) to make the file configurable

you can use path.join(WorkingDirectory, ConfigFile) to make the file configurable

Never mind, I missed that it runs before the CLI parser.

Never mind, I missed that it runs before the CLI parser.
zimbatm marked this conversation as resolved
zimbatm approved these changes 2024-02-24 10:06:33 +00:00
main.go Outdated
@ -23,1 +29,4 @@
// For the same reasons above we implement init like this
for _, arg := range os.Args {
if arg == "--init" || arg == "-i" {

Move this in the other loop, so the Args aren't being looped twice

Move this in the other loop, so the Args aren't being looped twice
brianmcgee marked this conversation as resolved
main.go Outdated
@ -24,0 +34,4 @@
fmt.Printf("Failed to write treefmt.toml: %v\n", err)
os.Exit(1)
}

It would be nice to say something like "Generated treefmt.toml. Now it's your turn to edit it."

It would be nice to say something like "Generated treefmt.toml. Now it's your turn to edit it."
brianmcgee marked this conversation as resolved
brianmcgee force-pushed feat/init from 2512b7f074 to 49596b8e08 2024-02-28 09:19:05 +00:00 Compare
brianmcgee merged commit 8333c99ebf into main 2024-02-28 09:19:37 +00:00
zimbatm deleted branch feat/init 2024-02-28 10:11:00 +00:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: numtide/treefmt#26
No description provided.