Documentation
¶
Overview ¶
Package githubfs provides an fs.FS implementation for GitHub repositories using the GitHub API.
Example ¶
package main
import (
"bufio"
"fmt"
"os"
"github.com/google/go-github/v74/github"
githubfs "github.com/sagikazarmark/go-github-fs"
)
func main() {
client := github.NewClient(nil)
if token := os.Getenv("GITHUB_TOKEN"); token != "" {
client = client.WithAuthToken(token)
}
fsys := githubfs.New(githubfs.WithClient(client))
file, err := fsys.Open("sagikazarmark/locafero/README.md")
if err != nil {
panic(err)
}
defer file.Close()
scanner := bufio.NewScanner(file)
scanner.Scan()
fmt.Println(scanner.Text())
}
Output: # Finder library for [Afero](https://github.com/spf13/afero)
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
ClientOption configures the filesystem using the functional options paradigm popularized by Rob Pike and Dave Cheney.
If you're unfamiliar with this style, check out the following articles:
- Self-referential functions and the design of options
- Functional options for friendly APIs
- Functional options on steroids
func WithContext ¶
WithContext configures a context.Context.
func WithContextFunc ¶
WithContextFunc configures a function that creates a new context for each request.
func WithRepository ¶
WithRepository configures the repository.
Click to show internal directories.
Click to hide internal directories.