diff --git a/internal/pkg/utils/os_fs.go b/internal/pkg/utils/os_fs.go new file mode 100644 index 000000000..790976108 --- /dev/null +++ b/internal/pkg/utils/os_fs.go @@ -0,0 +1,18 @@ +package utils + +import ( + "io/fs" + "os" +) + +var _ fs.ReadFileFS = OsFS{} + +type OsFS struct{} + +func (o OsFS) Open(name string) (fs.File, error) { + return os.Open(name) +} + +func (o OsFS) ReadFile(name string) ([]byte, error) { + return os.ReadFile(name) +} diff --git a/main.go b/main.go index 1ad561dc8..177afc4ba 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "github.com/stackitcloud/stackit-cli/internal/pkg/config" "github.com/stackitcloud/stackit-cli/internal/pkg/print" "github.com/stackitcloud/stackit-cli/internal/pkg/types" + "github.com/stackitcloud/stackit-cli/internal/pkg/utils" ) // These values are overwritten by GoReleaser at build time @@ -28,7 +29,7 @@ func main() { Printer: printer, CliVersion: version, Date: date, - Fs: os.DirFS("/"), + Fs: utils.OsFS{}, Args: os.Args[1:], } if !cmd.Execute(¶ms) {