Open prithvijj opened 5 months ago
I was going to look into adding this :+1: thanks !
Nice! I like this idea!
Changes:
#contributions
channel, ended up using the isatty
lib to render the huh form, such that when the unit tests are run, it doesn't affect itgo test -v ./...
but yeah, Lemme know if there's anything else missing
Changes:
Screenshot showing that a random directory is created beforehand and freeze is executed, which shows the overwrite confirmation form
Providing input this-is-dir
to show that it is overwriting to a directory
Throws error indicating that it could not overwrite to the directory, which is expected
pbj@pop-os:~/Github/freeze2$ mkdir this-is-dir
pbj@pop-os:~/Github/freeze2$ go run ./... --execute "cat SECURITY.md"
ERROR 'this-is-dir' is a directory. Hence cannot overwrite to the given filename
could not overwrite to filename
exit status 1
Looking for a re-review!
Just been having discussions on Discord Channel for #contributions
, been a bit stale on my end,
There was a good point made about figuring out if a flag could be introduced which overwrites the file in case no tty is recognized, and I've responded with it
Let's see what that looks like, shall keep the PR updated
Changes
huh.NewConfirm
andhuh.NewInput
fields, that checks if the output file already exists within the given directoryoverwrite
the file, execution continues as isnot overwrite
the file, aninput
field is provided to select a new output filenamehuh
forms will be rendered only if thestdout
is a terminalTesting Notes
go run ./... --execute "cat SECURITY.md"
Yes
will overwrite to the default output filenameRan the following command
go run ./... --execute "cat SECURITY.md"
againChoosing
No
will prompt an Input field to enter the new output filenameOther Notes
go test -v ./...
, the tests would hang, since it's probably expecting an input for thehuh
forms introduced. Would like to get some advice, shall ask on Discord too!CONTRIBUTING.md
and the issue I wanted to help out on https://github.com/charmbracelet/freeze/issues/35