i've been beating my head against a wall to try and figure this one out. i'm hoping someone may have had need to do this before and will be able to just throw in a snippet.
looking at this admittedly contrived example:
func (p *Project) InitProject(
ctx context.Context,
// +optional
source *dagger.Directory
} *dagger.Directory {
return source.WithNewFile("testfile.txt", "phwar")
}
So I would like to essentially scaffold source dir that is passed in, but i really don't like the ergonomics of requiring using export on the cmd line - i know that I can use the Export method on the directory, but what I need is the path that is passed in, but converted to a dagger.Directory type so that I can not make a user pass in the same path twice. anyone have any thoughts? i think it would essentially look like:
source.WithNewFile("testfile.txt", "phwar").Export(ctx, <<path of source>>, DirectoryExportOpts{})