Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Dump function to clone all the gists to local #5

Open
KEINOS opened this issue Jun 8, 2023 · 0 comments
Open

[Feature] Dump function to clone all the gists to local #5

KEINOS opened this issue Jun 8, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@KEINOS
Copy link
Owner

KEINOS commented Jun 8, 2023

gisty.Dump() to clone all the gist repos.

func gisty.Dump(outDir string, ignore ...gisty.Ignore) error
type gisty.Ignore func(gistInfo gisty.GistInfo) bool
  • Example usage
var IgnorePrivate gisty.Ignore = func(gistInfo gisty.GistInfo) bool {
    return !gistInfo.IsPublic
}

var IgnoreList gisty.Ignore = func(gistInfo gisty.GistInfo) bool {
    mapIgnore := map[string]struct{} {
        "7101f542be23e5048198e2a27c3cfda8": struct{}{},
        "da7101f542be23e5048198e2a27c3cf8": struct{}{},
    }
    
    _, ok := mapIgnore[gistInfo.GistID]

    return ok
}

pathDirOut := "."

err := gisty.Dump(pathDirOut, IgnorePrivate, IgnoreList)
if err != nil {
    log.Fatal(err)
}
@KEINOS KEINOS added the enhancement New feature or request label Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant