mirror of
https://github.com/spf13/cobra
synced 2025-05-05 04:47:22 +00:00
23 lines
645 B
Go
23 lines
645 B
Go
package doc
|
|
|
|
import "github.com/spf13/afero"
|
|
|
|
// This can be used by any code in current package that need to access filesystem
|
|
// It helps softwares using cobra's documentation generation to have better tests
|
|
var docFs *afero.Afero
|
|
|
|
func init() {
|
|
// By default, make the docFS a OS one, allowing real FS operations
|
|
docFs = &afero.Afero{Fs: afero.NewOsFs()}
|
|
}
|
|
|
|
// GetFS returns the current Afero FS used by the package
|
|
// Useful to backup the current FS, before setting a temp FS with SetFS
|
|
func GetFS() *afero.Afero {
|
|
return docFs
|
|
}
|
|
|
|
// SetFS defines the Afero FS that will be used by the package
|
|
func SetFS(fs *afero.Afero) {
|
|
docFs = fs
|
|
}
|