Documentation
¶
Overview ¶
Copyright (c) 2025 Guilherme Silva Sousa Licensed under the MIT License See LICENSE file in the project root for full license information. Package fs provides file system operations for ccmd
Copyright (c) 2025 Guilherme Silva Sousa Licensed under the MIT License See LICENSE file in the project root for full license information.
Copyright (c) 2025 Guilherme Silva Sousa Licensed under the MIT License See LICENSE file in the project root for full license information.
Index ¶
- func CreateDir(path string) error
- func DirExists(path string) bool
- func FileExists(path string) bool
- func GetClaudeCommandsDir() (string, error)
- func GetWorkingDir() (string, error)
- func JoinPath(elem ...string) string
- func ReadJSONFile(path string, v interface{}) error
- func ReadYAMLFile(path string, v interface{}) error
- func RemoveDir(path string) error
- func RemoveFile(path string) error
- func WriteJSONFile(path string, v interface{}) error
- func WriteYAMLFile(path string, v interface{}) error
- type FileSystem
- type MemFS
- func (m *MemFS) Clear()
- func (m *MemFS) DirExists(path string) bool
- func (m *MemFS) Exists(path string) (bool, error)
- func (m *MemFS) FileExists(path string) bool
- func (m *MemFS) Getenv(key string) string
- func (m *MemFS) List(pattern string) []string
- func (m *MemFS) MkdirAll(path string, perm os.FileMode) error
- func (m *MemFS) ReadDir(name string) ([]fs.DirEntry, error)
- func (m *MemFS) ReadFile(name string) ([]byte, error)
- func (m *MemFS) Remove(name string) error
- func (m *MemFS) RemoveAll(path string) error
- func (m *MemFS) Rename(oldpath, newpath string) error
- func (m *MemFS) Setenv(key, value string) error
- func (m *MemFS) Stat(name string) (fs.FileInfo, error)
- func (m *MemFS) String() string
- func (m *MemFS) WriteFile(name string, data []byte, perm os.FileMode) error
- type OS
- func (OS) Exists(path string) (bool, error)
- func (OS) MkdirAll(path string, perm os.FileMode) error
- func (OS) ReadDir(name string) ([]fs.DirEntry, error)
- func (OS) ReadFile(name string) ([]byte, error)
- func (OS) Remove(name string) error
- func (OS) RemoveAll(path string) error
- func (OS) Rename(oldpath, newpath string) error
- func (OS) Stat(name string) (fs.FileInfo, error)
- func (OS) WriteFile(name string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetClaudeCommandsDir ¶
GetClaudeCommandsDir returns the path to .claude/commands/ directory Creates the directory if it doesn't exist Deprecated: This function uses the home directory instead of project directory. Use project-relative paths (.claude) instead.
func GetWorkingDir ¶
GetWorkingDir returns the current working directory
func ReadJSONFile ¶
ReadJSONFile reads and unmarshals a JSON file
func ReadYAMLFile ¶
ReadYAMLFile reads and unmarshals a YAML file
func WriteJSONFile ¶
WriteJSONFile marshals and writes data to a JSON file with indentation
func WriteYAMLFile ¶
WriteYAMLFile marshals and writes data to a YAML file
Types ¶
type FileSystem ¶
type FileSystem interface {
ReadFile(name string) ([]byte, error)
WriteFile(name string, data []byte, perm os.FileMode) error
Remove(name string) error
RemoveAll(path string) error
Rename(oldpath, newpath string) error
Stat(name string) (fs.FileInfo, error)
MkdirAll(path string, perm os.FileMode) error
ReadDir(name string) ([]fs.DirEntry, error)
Exists(path string) (bool, error)
}
FileSystem is an interface for file system operations
func NewMemoryFileSystem ¶
func NewMemoryFileSystem() FileSystem
NewMemoryFileSystem returns a new in-memory file system implementation
func NewOSFileSystem ¶
func NewOSFileSystem() FileSystem
NewOSFileSystem returns a new OS file system implementation
type MemFS ¶
type MemFS struct {
// contains filtered or unexported fields
}
MemFS is an in-memory implementation of FileSystem for testing
func (*MemFS) FileExists ¶ added in v1.0.0
FileExists checks if a file exists
func (*MemFS) ReadDir ¶
ReadDir reads the directory named by dirname and returns a list of directory entries
type OS ¶
type OS struct{}
OS implements FileSystem using the real file system
func (OS) ReadDir ¶
ReadDir reads the directory named by dirname and returns a list of directory entries