id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
28,900
gopasspw/gopass
pkg/action/find.go
findSelection
func (s *Action) findSelection(ctx context.Context, c *cli.Context, choices []string, needle string, cb showFunc) error { sort.Strings(choices) act, sel := cui.GetSelection(ctx, "Found secrets - Please select an entry", "<↑/↓> to change the selection, <→> to show, <←> to copy, <s> to sync, <e> to edit, <ESC> to quit"...
go
func (s *Action) findSelection(ctx context.Context, c *cli.Context, choices []string, needle string, cb showFunc) error { sort.Strings(choices) act, sel := cui.GetSelection(ctx, "Found secrets - Please select an entry", "<↑/↓> to change the selection, <→> to show, <←> to copy, <s> to sync, <e> to edit, <ESC> to quit"...
[ "func", "(", "s", "*", "Action", ")", "findSelection", "(", "ctx", "context", ".", "Context", ",", "c", "*", "cli", ".", "Context", ",", "choices", "[", "]", "string", ",", "needle", "string", ",", "cb", "showFunc", ")", "error", "{", "sort", ".", ...
// findSelection runs a wizard that lets the user select an entry
[ "findSelection", "runs", "a", "wizard", "that", "lets", "the", "user", "select", "an", "entry" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/find.go#L75-L105
28,901
gopasspw/gopass
pkg/qrcon/qrcon.go
QRCode
func QRCode(content string) (string, error) { q, err := qrcode.New(content, qrcode.Medium) if err != nil { return "", err } buf := bytes.Buffer{} i := q.Image(0) b := i.Bounds() for x := b.Min.X; x < b.Max.X; x++ { for y := b.Min.Y; y < b.Max.Y; y++ { col := i.At(x, y) if sameColor(col, q.ForegroundCol...
go
func QRCode(content string) (string, error) { q, err := qrcode.New(content, qrcode.Medium) if err != nil { return "", err } buf := bytes.Buffer{} i := q.Image(0) b := i.Bounds() for x := b.Min.X; x < b.Max.X; x++ { for y := b.Min.Y; y < b.Max.Y; y++ { col := i.At(x, y) if sameColor(col, q.ForegroundCol...
[ "func", "QRCode", "(", "content", "string", ")", "(", "string", ",", "error", ")", "{", "q", ",", "err", ":=", "qrcode", ".", "New", "(", "content", ",", "qrcode", ".", "Medium", ")", "\n", "if", "err", "!=", "nil", "{", "return", "\"", "\"", ","...
// QRCode returns a string containing an ANSI encoded // QR Code
[ "QRCode", "returns", "a", "string", "containing", "an", "ANSI", "encoded", "QR", "Code" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/qrcon/qrcon.go#L18-L40
28,902
gopasspw/gopass
pkg/store/root/read.go
GetContext
func (r *Store) GetContext(ctx context.Context, name string) (store.Secret, context.Context, error) { // forward to substore ctx, store, name := r.getStore(ctx, name) sec, err := store.Get(ctx, name) return sec, ctx, err }
go
func (r *Store) GetContext(ctx context.Context, name string) (store.Secret, context.Context, error) { // forward to substore ctx, store, name := r.getStore(ctx, name) sec, err := store.Get(ctx, name) return sec, ctx, err }
[ "func", "(", "r", "*", "Store", ")", "GetContext", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "store", ".", "Secret", ",", "context", ".", "Context", ",", "error", ")", "{", "// forward to substore", "ctx", ",", "store", ",...
// GetContext returns the plaintext and the context of a single key
[ "GetContext", "returns", "the", "plaintext", "and", "the", "context", "of", "a", "single", "key" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/read.go#L17-L22
28,903
gopasspw/gopass
pkg/tree/simple/tree.go
New
func New(name string) *Folder { f := newFolder(name) f.Root = true return f }
go
func New(name string) *Folder { f := newFolder(name) f.Root = true return f }
[ "func", "New", "(", "name", "string", ")", "*", "Folder", "{", "f", ":=", "newFolder", "(", "name", ")", "\n", "f", ".", "Root", "=", "true", "\n", "return", "f", "\n", "}" ]
// New create a new root folder
[ "New", "create", "a", "new", "root", "folder" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/tree.go#L27-L31
28,904
gopasspw/gopass
pkg/updater/update_others.go
IsUpdateable
func IsUpdateable(ctx context.Context) error { fn, err := executable(ctx) if err != nil { return err } out.Debug(ctx, "isUpdateable - File: %s", fn) // check if this is a test binary if strings.HasSuffix(filepath.Base(fn), ".test") { return nil } // check if we want to force updateability if uf := os.Gete...
go
func IsUpdateable(ctx context.Context) error { fn, err := executable(ctx) if err != nil { return err } out.Debug(ctx, "isUpdateable - File: %s", fn) // check if this is a test binary if strings.HasSuffix(filepath.Base(fn), ".test") { return nil } // check if we want to force updateability if uf := os.Gete...
[ "func", "IsUpdateable", "(", "ctx", "context", ".", "Context", ")", "error", "{", "fn", ",", "err", ":=", "executable", "(", "ctx", ")", "\n", "if", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n", "out", ".", "Debug", "(", "ctx", ",", ...
// IsUpdateable returns an error if this binary is not updateable
[ "IsUpdateable", "returns", "an", "error", "if", "this", "binary", "is", "not", "updateable" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/updater/update_others.go#L77-L114
28,905
gopasspw/gopass
pkg/config/location.go
Homedir
func Homedir() string { if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" { return hd } hd, err := homedir.Dir() if err != nil { if debug { fmt.Printf("[DEBUG] Failed to get homedir: %s\n", err) } return "" } return hd }
go
func Homedir() string { if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" { return hd } hd, err := homedir.Dir() if err != nil { if debug { fmt.Printf("[DEBUG] Failed to get homedir: %s\n", err) } return "" } return hd }
[ "func", "Homedir", "(", ")", "string", "{", "if", "hd", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "hd", "!=", "\"", "\"", "{", "return", "hd", "\n", "}", "\n", "hd", ",", "err", ":=", "homedir", ".", "Dir", "(", ")", "\n", "if", ...
// Homedir returns the users home dir or an empty string if the lookup fails
[ "Homedir", "returns", "the", "users", "home", "dir", "or", "an", "empty", "string", "if", "the", "lookup", "fails" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/location.go#L15-L27
28,906
gopasspw/gopass
pkg/config/location.go
configLocations
func configLocations() []string { l := []string{} if cf := os.Getenv("GOPASS_CONFIG"); cf != "" { l = append(l, cf) } if xch := os.Getenv("XDG_CONFIG_HOME"); xch != "" { l = append(l, filepath.Join(xch, "gopass", "config.yml")) } l = append(l, filepath.Join(Homedir(), ".config", "gopass", "config.yml")) l = ...
go
func configLocations() []string { l := []string{} if cf := os.Getenv("GOPASS_CONFIG"); cf != "" { l = append(l, cf) } if xch := os.Getenv("XDG_CONFIG_HOME"); xch != "" { l = append(l, filepath.Join(xch, "gopass", "config.yml")) } l = append(l, filepath.Join(Homedir(), ".config", "gopass", "config.yml")) l = ...
[ "func", "configLocations", "(", ")", "[", "]", "string", "{", "l", ":=", "[", "]", "string", "{", "}", "\n", "if", "cf", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "cf", "!=", "\"", "\"", "{", "l", "=", "append", "(", "l", ",", "...
// configLocations returns the possible locations of gopass config files, // in decreasing priority
[ "configLocations", "returns", "the", "possible", "locations", "of", "gopass", "config", "files", "in", "decreasing", "priority" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/location.go#L49-L60
28,907
gopasspw/gopass
pkg/jsonapi/manifest/wrapper.go
Render
func Render(browser, wrapperPath, binPath string, global bool) ([]byte, []byte, error) { mf, err := getManifestContent(browser, wrapperPath) if err != nil { return nil, nil, err } if binPath == "" { binPath = gopassPath(global) } wrap, err := getWrapperContent(binPath) if err != nil { return nil, nil, err...
go
func Render(browser, wrapperPath, binPath string, global bool) ([]byte, []byte, error) { mf, err := getManifestContent(browser, wrapperPath) if err != nil { return nil, nil, err } if binPath == "" { binPath = gopassPath(global) } wrap, err := getWrapperContent(binPath) if err != nil { return nil, nil, err...
[ "func", "Render", "(", "browser", ",", "wrapperPath", ",", "binPath", "string", ",", "global", "bool", ")", "(", "[", "]", "byte", ",", "[", "]", "byte", ",", "error", ")", "{", "mf", ",", "err", ":=", "getManifestContent", "(", "browser", ",", "wrap...
// Render returns the rendered wrapper and manifest
[ "Render", "returns", "the", "rendered", "wrapper", "and", "manifest" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/wrapper.go#L31-L46
28,908
gopasspw/gopass
pkg/store/root/git.go
GitInit
func (r *Store) GitInit(ctx context.Context, name, userName, userEmail string) error { ctx, store, _ := r.getStore(ctx, name) return store.GitInit(ctx, userName, userEmail) }
go
func (r *Store) GitInit(ctx context.Context, name, userName, userEmail string) error { ctx, store, _ := r.getStore(ctx, name) return store.GitInit(ctx, userName, userEmail) }
[ "func", "(", "r", "*", "Store", ")", "GitInit", "(", "ctx", "context", ".", "Context", ",", "name", ",", "userName", ",", "userEmail", "string", ")", "error", "{", "ctx", ",", "store", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", ...
// GitInit initializes the git repo
[ "GitInit", "initializes", "the", "git", "repo" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L22-L25
28,909
gopasspw/gopass
pkg/store/root/git.go
GitInitConfig
func (r *Store) GitInitConfig(ctx context.Context, name, userName, userEmail string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().InitConfig(ctx, userName, userEmail) }
go
func (r *Store) GitInitConfig(ctx context.Context, name, userName, userEmail string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().InitConfig(ctx, userName, userEmail) }
[ "func", "(", "r", "*", "Store", ")", "GitInitConfig", "(", "ctx", "context", ".", "Context", ",", "name", ",", "userName", ",", "userEmail", "string", ")", "error", "{", "ctx", ",", "store", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "n...
// GitInitConfig initializes the git repos local config
[ "GitInitConfig", "initializes", "the", "git", "repos", "local", "config" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L28-L31
28,910
gopasspw/gopass
pkg/store/root/git.go
GitVersion
func (r *Store) GitVersion(ctx context.Context) semver.Version { return r.store.RCS().Version(ctx) }
go
func (r *Store) GitVersion(ctx context.Context) semver.Version { return r.store.RCS().Version(ctx) }
[ "func", "(", "r", "*", "Store", ")", "GitVersion", "(", "ctx", "context", ".", "Context", ")", "semver", ".", "Version", "{", "return", "r", ".", "store", ".", "RCS", "(", ")", ".", "Version", "(", "ctx", ")", "\n", "}" ]
// GitVersion returns git version information
[ "GitVersion", "returns", "git", "version", "information" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L34-L36
28,911
gopasspw/gopass
pkg/store/root/git.go
GitAddRemote
func (r *Store) GitAddRemote(ctx context.Context, name, remote, url string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().AddRemote(ctx, remote, url) }
go
func (r *Store) GitAddRemote(ctx context.Context, name, remote, url string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().AddRemote(ctx, remote, url) }
[ "func", "(", "r", "*", "Store", ")", "GitAddRemote", "(", "ctx", "context", ".", "Context", ",", "name", ",", "remote", ",", "url", "string", ")", "error", "{", "ctx", ",", "store", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", "...
// GitAddRemote adds a git remote
[ "GitAddRemote", "adds", "a", "git", "remote" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L39-L42
28,912
gopasspw/gopass
pkg/store/root/git.go
GitRemoveRemote
func (r *Store) GitRemoveRemote(ctx context.Context, name, remote string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().RemoveRemote(ctx, remote) }
go
func (r *Store) GitRemoveRemote(ctx context.Context, name, remote string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().RemoveRemote(ctx, remote) }
[ "func", "(", "r", "*", "Store", ")", "GitRemoveRemote", "(", "ctx", "context", ".", "Context", ",", "name", ",", "remote", "string", ")", "error", "{", "ctx", ",", "store", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", ")", "\n", ...
// GitRemoveRemote removes a git remote
[ "GitRemoveRemote", "removes", "a", "git", "remote" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L45-L48
28,913
gopasspw/gopass
pkg/store/root/git.go
GitPull
func (r *Store) GitPull(ctx context.Context, name, origin, remote string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().Pull(ctx, origin, remote) }
go
func (r *Store) GitPull(ctx context.Context, name, origin, remote string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().Pull(ctx, origin, remote) }
[ "func", "(", "r", "*", "Store", ")", "GitPull", "(", "ctx", "context", ".", "Context", ",", "name", ",", "origin", ",", "remote", "string", ")", "error", "{", "ctx", ",", "store", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", ")"...
// GitPull performs a git pull
[ "GitPull", "performs", "a", "git", "pull" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L51-L54
28,914
gopasspw/gopass
pkg/store/root/git.go
GitPush
func (r *Store) GitPush(ctx context.Context, name, origin, remote string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().Push(ctx, origin, remote) }
go
func (r *Store) GitPush(ctx context.Context, name, origin, remote string) error { ctx, store, _ := r.getStore(ctx, name) return store.RCS().Push(ctx, origin, remote) }
[ "func", "(", "r", "*", "Store", ")", "GitPush", "(", "ctx", "context", ".", "Context", ",", "name", ",", "origin", ",", "remote", "string", ")", "error", "{", "ctx", ",", "store", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", ")"...
// GitPush performs a git push
[ "GitPush", "performs", "a", "git", "push" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L57-L60
28,915
gopasspw/gopass
pkg/store/root/git.go
ListRevisions
func (r *Store) ListRevisions(ctx context.Context, name string) ([]backend.Revision, error) { ctx, store, name := r.getStore(ctx, name) return store.ListRevisions(ctx, name) }
go
func (r *Store) ListRevisions(ctx context.Context, name string) ([]backend.Revision, error) { ctx, store, name := r.getStore(ctx, name) return store.ListRevisions(ctx, name) }
[ "func", "(", "r", "*", "Store", ")", "ListRevisions", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "[", "]", "backend", ".", "Revision", ",", "error", ")", "{", "ctx", ",", "store", ",", "name", ":=", "r", ".", "getStore"...
// ListRevisions will list all revisions for the named entity
[ "ListRevisions", "will", "list", "all", "revisions", "for", "the", "named", "entity" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L63-L66
28,916
gopasspw/gopass
pkg/store/root/git.go
GetRevision
func (r *Store) GetRevision(ctx context.Context, name, revision string) (store.Secret, error) { ctx, store, name := r.getStore(ctx, name) return store.GetRevision(ctx, name, revision) }
go
func (r *Store) GetRevision(ctx context.Context, name, revision string) (store.Secret, error) { ctx, store, name := r.getStore(ctx, name) return store.GetRevision(ctx, name, revision) }
[ "func", "(", "r", "*", "Store", ")", "GetRevision", "(", "ctx", "context", ".", "Context", ",", "name", ",", "revision", "string", ")", "(", "store", ".", "Secret", ",", "error", ")", "{", "ctx", ",", "store", ",", "name", ":=", "r", ".", "getStore...
// GetRevision will try to retrieve the given revision from the sync backend
[ "GetRevision", "will", "try", "to", "retrieve", "the", "given", "revision", "from", "the", "sync", "backend" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L69-L72
28,917
gopasspw/gopass
pkg/backend/rcs/git/gogit/loader.go
Init
func (l loader) Init(ctx context.Context, path, username, email string) (backend.RCS, error) { return Init(ctx, path) }
go
func (l loader) Init(ctx context.Context, path, username, email string) (backend.RCS, error) { return Init(ctx, path) }
[ "func", "(", "l", "loader", ")", "Init", "(", "ctx", "context", ".", "Context", ",", "path", ",", "username", ",", "email", "string", ")", "(", "backend", ".", "RCS", ",", "error", ")", "{", "return", "Init", "(", "ctx", ",", "path", ")", "\n", "...
// Init implements backend.RCSLoader
[ "Init", "implements", "backend", ".", "RCSLoader" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/loader.go#L32-L34
28,918
gopasspw/gopass
pkg/action/insert.go
Insert
func (s *Action) Insert(ctx context.Context, c *cli.Context) error { echo := c.Bool("echo") multiline := c.Bool("multiline") force := c.Bool("force") append := c.Bool("append") args, kvps := parseArgs(c) name := args.Get(0) key := args.Get(1) if name == "" { return ExitError(ctx, ExitNoName, nil, "Usage: %s...
go
func (s *Action) Insert(ctx context.Context, c *cli.Context) error { echo := c.Bool("echo") multiline := c.Bool("multiline") force := c.Bool("force") append := c.Bool("append") args, kvps := parseArgs(c) name := args.Get(0) key := args.Get(1) if name == "" { return ExitError(ctx, ExitNoName, nil, "Usage: %s...
[ "func", "(", "s", "*", "Action", ")", "Insert", "(", "ctx", "context", ".", "Context", ",", "c", "*", "cli", ".", "Context", ")", "error", "{", "echo", ":=", "c", ".", "Bool", "(", "\"", "\"", ")", "\n", "multiline", ":=", "c", ".", "Bool", "("...
// Insert a string as content to a secret file
[ "Insert", "a", "string", "as", "content", "to", "a", "secret", "file" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/insert.go#L23-L38
28,919
gopasspw/gopass
pkg/config/io.go
Load
func Load() *Config { for _, l := range configLocations() { if debug { fmt.Printf("[DEBUG] Trying to load config from %s\n", l) } cfg, err := load(l) if err == ErrConfigNotFound { continue } if err != nil { panic(err) } _ = cfg.checkDefaults() if debug { fmt.Printf("[DEBUG] Loaded config ...
go
func Load() *Config { for _, l := range configLocations() { if debug { fmt.Printf("[DEBUG] Trying to load config from %s\n", l) } cfg, err := load(l) if err == ErrConfigNotFound { continue } if err != nil { panic(err) } _ = cfg.checkDefaults() if debug { fmt.Printf("[DEBUG] Loaded config ...
[ "func", "Load", "(", ")", "*", "Config", "{", "for", "_", ",", "l", ":=", "range", "configLocations", "(", ")", "{", "if", "debug", "{", "fmt", ".", "Printf", "(", "\"", "\\n", "\"", ",", "l", ")", "\n", "}", "\n", "cfg", ",", "err", ":=", "l...
// Load will try to load the config from one of the default locations
[ "Load", "will", "try", "to", "load", "the", "config", "from", "one", "of", "the", "default", "locations" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/io.go#L17-L42
28,920
gopasspw/gopass
pkg/config/io.go
Save
func (c *Config) Save() error { if err := c.checkDefaults(); err != nil { return err } buf, err := yaml.Marshal(c) if err != nil { return errors.Wrapf(err, "failed to marshal YAML") } cfgLoc := configLocation() cfgDir := filepath.Dir(cfgLoc) if !fsutil.IsDir(cfgDir) { if err := os.MkdirAll(cfgDir, 0700)...
go
func (c *Config) Save() error { if err := c.checkDefaults(); err != nil { return err } buf, err := yaml.Marshal(c) if err != nil { return errors.Wrapf(err, "failed to marshal YAML") } cfgLoc := configLocation() cfgDir := filepath.Dir(cfgLoc) if !fsutil.IsDir(cfgDir) { if err := os.MkdirAll(cfgDir, 0700)...
[ "func", "(", "c", "*", "Config", ")", "Save", "(", ")", "error", "{", "if", "err", ":=", "c", ".", "checkDefaults", "(", ")", ";", "err", "!=", "nil", "{", "return", "err", "\n", "}", "\n\n", "buf", ",", "err", ":=", "yaml", ".", "Marshal", "("...
// Save saves the config
[ "Save", "saves", "the", "config" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/io.go#L119-L143
28,921
gopasspw/gopass
pkg/action/delete.go
Delete
func (s *Action) Delete(ctx context.Context, c *cli.Context) error { force := c.Bool("force") recursive := c.Bool("recursive") name := c.Args().First() if name == "" { return ExitError(ctx, ExitUsage, nil, "Usage: %s rm name", s.Name) } if !recursive && s.Store.IsDir(ctx, name) { return ExitError(ctx, ExitU...
go
func (s *Action) Delete(ctx context.Context, c *cli.Context) error { force := c.Bool("force") recursive := c.Bool("recursive") name := c.Args().First() if name == "" { return ExitError(ctx, ExitUsage, nil, "Usage: %s rm name", s.Name) } if !recursive && s.Store.IsDir(ctx, name) { return ExitError(ctx, ExitU...
[ "func", "(", "s", "*", "Action", ")", "Delete", "(", "ctx", "context", ".", "Context", ",", "c", "*", "cli", ".", "Context", ")", "error", "{", "force", ":=", "c", ".", "Bool", "(", "\"", "\"", ")", "\n", "recursive", ":=", "c", ".", "Bool", "(...
// Delete a secret file with its content
[ "Delete", "a", "secret", "file", "with", "its", "content" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/delete.go#L14-L56
28,922
gopasspw/gopass
pkg/action/delete.go
deleteKeyFromYAML
func (s *Action) deleteKeyFromYAML(ctx context.Context, name, key string) error { sec, err := s.Store.Get(ctx, name) if err != nil { return ExitError(ctx, ExitIO, err, "Can not delete key '%s' from '%s': %s", key, name, err) } if err := sec.DeleteKey(key); err != nil { return ExitError(ctx, ExitIO, err, "Can no...
go
func (s *Action) deleteKeyFromYAML(ctx context.Context, name, key string) error { sec, err := s.Store.Get(ctx, name) if err != nil { return ExitError(ctx, ExitIO, err, "Can not delete key '%s' from '%s': %s", key, name, err) } if err := sec.DeleteKey(key); err != nil { return ExitError(ctx, ExitIO, err, "Can no...
[ "func", "(", "s", "*", "Action", ")", "deleteKeyFromYAML", "(", "ctx", "context", ".", "Context", ",", "name", ",", "key", "string", ")", "error", "{", "sec", ",", "err", ":=", "s", ".", "Store", ".", "Get", "(", "ctx", ",", "name", ")", "\n", "i...
// deleteKeyFromYAML deletes a single key from YAML
[ "deleteKeyFromYAML", "deletes", "a", "single", "key", "from", "YAML" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/delete.go#L59-L71
28,923
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Open
func Open(path string) (*Git, error) { r, err := git.PlainOpen(path) if err != nil { return nil, err } w, err := r.Worktree() if err != nil { return nil, err } return &Git{ path: path, repo: r, wt: w, }, nil }
go
func Open(path string) (*Git, error) { r, err := git.PlainOpen(path) if err != nil { return nil, err } w, err := r.Worktree() if err != nil { return nil, err } return &Git{ path: path, repo: r, wt: w, }, nil }
[ "func", "Open", "(", "path", "string", ")", "(", "*", "Git", ",", "error", ")", "{", "r", ",", "err", ":=", "git", ".", "PlainOpen", "(", "path", ")", "\n", "if", "err", "!=", "nil", "{", "return", "nil", ",", "err", "\n", "}", "\n\n", "w", "...
// Open tries to open an existing git repo on disk
[ "Open", "tries", "to", "open", "an", "existing", "git", "repo", "on", "disk" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L38-L54
28,924
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Clone
func Clone(ctx context.Context, repo, path string) (*Git, error) { r, err := git.PlainCloneContext(ctx, path, false, &git.CloneOptions{ URL: repo, Progress: Stdout, }) if err != nil { return nil, err } w, err := r.Worktree() if err != nil { return nil, err } return &Git{ path: path, repo: r, ...
go
func Clone(ctx context.Context, repo, path string) (*Git, error) { r, err := git.PlainCloneContext(ctx, path, false, &git.CloneOptions{ URL: repo, Progress: Stdout, }) if err != nil { return nil, err } w, err := r.Worktree() if err != nil { return nil, err } return &Git{ path: path, repo: r, ...
[ "func", "Clone", "(", "ctx", "context", ".", "Context", ",", "repo", ",", "path", "string", ")", "(", "*", "Git", ",", "error", ")", "{", "r", ",", "err", ":=", "git", ".", "PlainCloneContext", "(", "ctx", ",", "path", ",", "false", ",", "&", "gi...
// Clone tries to clone an git repo from a remote
[ "Clone", "tries", "to", "clone", "an", "git", "repo", "from", "a", "remote" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L57-L76
28,925
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Init
func Init(ctx context.Context, path string) (*Git, error) { g := &Git{ path: path, } if !g.IsInitialized() { r, err := git.PlainInit(path, false) if err != nil { return nil, errors.Wrapf(err, "Failed to initialize git: %s", err) } g.repo = r wt, err := g.repo.Worktree() if err != nil { return ni...
go
func Init(ctx context.Context, path string) (*Git, error) { g := &Git{ path: path, } if !g.IsInitialized() { r, err := git.PlainInit(path, false) if err != nil { return nil, errors.Wrapf(err, "Failed to initialize git: %s", err) } g.repo = r wt, err := g.repo.Worktree() if err != nil { return ni...
[ "func", "Init", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "(", "*", "Git", ",", "error", ")", "{", "g", ":=", "&", "Git", "{", "path", ":", "path", ",", "}", "\n\n", "if", "!", "g", ".", "IsInitialized", "(", ")", "{", ...
// Init creates a new git repo on disk
[ "Init", "creates", "a", "new", "git", "repo", "on", "disk" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L79-L117
28,926
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
IsInitialized
func (g *Git) IsInitialized() bool { _, err := git.PlainOpen(g.path) return err == nil }
go
func (g *Git) IsInitialized() bool { _, err := git.PlainOpen(g.path) return err == nil }
[ "func", "(", "g", "*", "Git", ")", "IsInitialized", "(", ")", "bool", "{", "_", ",", "err", ":=", "git", ".", "PlainOpen", "(", "g", ".", "path", ")", "\n", "return", "err", "==", "nil", "\n", "}" ]
// IsInitialized returns true if this is a valid repo
[ "IsInitialized", "returns", "true", "if", "this", "is", "a", "valid", "repo" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L128-L131
28,927
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Add
func (g *Git) Add(ctx context.Context, files ...string) error { if len(files) < 1 || (len(files) == 1 && files[0] == g.path) { return g.addAll() } for _, file := range files { if strings.HasPrefix(file, g.path) { file = strings.TrimPrefix(file, g.path+string(filepath.Separator)) } _, err := g.wt.Add(file)...
go
func (g *Git) Add(ctx context.Context, files ...string) error { if len(files) < 1 || (len(files) == 1 && files[0] == g.path) { return g.addAll() } for _, file := range files { if strings.HasPrefix(file, g.path) { file = strings.TrimPrefix(file, g.path+string(filepath.Separator)) } _, err := g.wt.Add(file)...
[ "func", "(", "g", "*", "Git", ")", "Add", "(", "ctx", "context", ".", "Context", ",", "files", "...", "string", ")", "error", "{", "if", "len", "(", "files", ")", "<", "1", "||", "(", "len", "(", "files", ")", "==", "1", "&&", "files", "[", "...
// Add adds any number of files to git
[ "Add", "adds", "any", "number", "of", "files", "to", "git" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L134-L148
28,928
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
HasStagedChanges
func (g *Git) HasStagedChanges(ctx context.Context) bool { st, err := g.wt.Status() if err != nil { out.Error(ctx, "Error: Unable to get status: %s", err) return false } return !st.IsClean() }
go
func (g *Git) HasStagedChanges(ctx context.Context) bool { st, err := g.wt.Status() if err != nil { out.Error(ctx, "Error: Unable to get status: %s", err) return false } return !st.IsClean() }
[ "func", "(", "g", "*", "Git", ")", "HasStagedChanges", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "st", ",", "err", ":=", "g", ".", "wt", ".", "Status", "(", ")", "\n", "if", "err", "!=", "nil", "{", "out", ".", "Error", "(", "ctx...
// HasStagedChanges retures true if there are changes which can be committed
[ "HasStagedChanges", "retures", "true", "if", "there", "are", "changes", "which", "can", "be", "committed" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L182-L189
28,929
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Commit
func (g *Git) Commit(ctx context.Context, msg string) error { if !g.HasStagedChanges(ctx) { return store.ErrGitNothingToCommit } _, err := g.wt.Commit(msg, &git.CommitOptions{ All: true, Author: &object.Signature{ Name: os.Getenv("GIT_AUTHOR_NAME"), Email: os.Getenv("GIT_AUTHOR_EMAIL"), When: time....
go
func (g *Git) Commit(ctx context.Context, msg string) error { if !g.HasStagedChanges(ctx) { return store.ErrGitNothingToCommit } _, err := g.wt.Commit(msg, &git.CommitOptions{ All: true, Author: &object.Signature{ Name: os.Getenv("GIT_AUTHOR_NAME"), Email: os.Getenv("GIT_AUTHOR_EMAIL"), When: time....
[ "func", "(", "g", "*", "Git", ")", "Commit", "(", "ctx", "context", ".", "Context", ",", "msg", "string", ")", "error", "{", "if", "!", "g", ".", "HasStagedChanges", "(", "ctx", ")", "{", "return", "store", ".", "ErrGitNothingToCommit", "\n", "}", "\...
// Commit creates a new commit
[ "Commit", "creates", "a", "new", "commit" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L192-L206
28,930
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
PushPull
func (g *Git) PushPull(ctx context.Context, op, remote, branch string) error { if err := g.Pull(ctx, remote, branch); err != nil { if op == "pull" { return err } out.Yellow(ctx, "Failed to pull before git push: %s", err) } if op == "pull" { return nil } return g.Push(ctx, remote, branch) }
go
func (g *Git) PushPull(ctx context.Context, op, remote, branch string) error { if err := g.Pull(ctx, remote, branch); err != nil { if op == "pull" { return err } out.Yellow(ctx, "Failed to pull before git push: %s", err) } if op == "pull" { return nil } return g.Push(ctx, remote, branch) }
[ "func", "(", "g", "*", "Git", ")", "PushPull", "(", "ctx", "context", ".", "Context", ",", "op", ",", "remote", ",", "branch", "string", ")", "error", "{", "if", "err", ":=", "g", ".", "Pull", "(", "ctx", ",", "remote", ",", "branch", ")", ";", ...
// PushPull will first pull from the remote and then push any changes
[ "PushPull", "will", "first", "pull", "from", "the", "remote", "and", "then", "push", "any", "changes" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L209-L221
28,931
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Pull
func (g *Git) Pull(ctx context.Context, remote, branch string) error { if !g.IsInitialized() { return store.ErrGitNotInit } if remote == "" { remote = "origin" } if branch == "" { branch = "master" } cfg, err := g.repo.Config() if err != nil { return errors.Wrapf(err, "Failed to get git config: %s", e...
go
func (g *Git) Pull(ctx context.Context, remote, branch string) error { if !g.IsInitialized() { return store.ErrGitNotInit } if remote == "" { remote = "origin" } if branch == "" { branch = "master" } cfg, err := g.repo.Config() if err != nil { return errors.Wrapf(err, "Failed to get git config: %s", e...
[ "func", "(", "g", "*", "Git", ")", "Pull", "(", "ctx", "context", ".", "Context", ",", "remote", ",", "branch", "string", ")", "error", "{", "if", "!", "g", ".", "IsInitialized", "(", ")", "{", "return", "store", ".", "ErrGitNotInit", "\n", "}", "\...
// Pull will pull any changes
[ "Pull", "will", "pull", "any", "changes" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L224-L249
28,932
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Push
func (g *Git) Push(ctx context.Context, remote, branch string) error { if !g.IsInitialized() { return store.ErrGitNotInit } if remote == "" { remote = "origin" } cfg, err := g.repo.Config() if err != nil { return errors.Wrapf(err, "Failed to get git config: %s", err) } if _, found := cfg.Remotes[remote]...
go
func (g *Git) Push(ctx context.Context, remote, branch string) error { if !g.IsInitialized() { return store.ErrGitNotInit } if remote == "" { remote = "origin" } cfg, err := g.repo.Config() if err != nil { return errors.Wrapf(err, "Failed to get git config: %s", err) } if _, found := cfg.Remotes[remote]...
[ "func", "(", "g", "*", "Git", ")", "Push", "(", "ctx", "context", ".", "Context", ",", "remote", ",", "branch", "string", ")", "error", "{", "if", "!", "g", ".", "IsInitialized", "(", ")", "{", "return", "store", ".", "ErrGitNotInit", "\n", "}", "\...
// Push will push any changes to the remote
[ "Push", "will", "push", "any", "changes", "to", "the", "remote" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L252-L272
28,933
gopasspw/gopass
pkg/backend/rcs/git/gogit/git.go
Cmd
func (g *Git) Cmd(context.Context, string, ...string) error { return fmt.Errorf("not supported") }
go
func (g *Git) Cmd(context.Context, string, ...string) error { return fmt.Errorf("not supported") }
[ "func", "(", "g", "*", "Git", ")", "Cmd", "(", "context", ".", "Context", ",", "string", ",", "...", "string", ")", "error", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}" ]
// Cmd is not supported and will go away eventually
[ "Cmd", "is", "not", "supported", "and", "will", "go", "away", "eventually" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L275-L277
28,934
gopasspw/gopass
pkg/store/root/gpg.go
Crypto
func (r *Store) Crypto(ctx context.Context, name string) backend.Crypto { _, sub, _ := r.getStore(ctx, name) if !sub.Valid() { out.Debug(ctx, "Sub-Store not found for %s. Returning nil crypto backend", name) return nil } return sub.Crypto() }
go
func (r *Store) Crypto(ctx context.Context, name string) backend.Crypto { _, sub, _ := r.getStore(ctx, name) if !sub.Valid() { out.Debug(ctx, "Sub-Store not found for %s. Returning nil crypto backend", name) return nil } return sub.Crypto() }
[ "func", "(", "r", "*", "Store", ")", "Crypto", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "backend", ".", "Crypto", "{", "_", ",", "sub", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", ")", "\n", "if", "!...
// Crypto returns the crypto backend
[ "Crypto", "returns", "the", "crypto", "backend" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/gpg.go#L11-L18
28,935
gopasspw/gopass
pkg/action/audit.go
Audit
func (s *Action) Audit(ctx context.Context, c *cli.Context) error { filter := c.Args().First() ctx = s.Store.WithConfig(ctx, filter) out.Print(ctx, "Auditing passwords for common flaws ...") t, err := s.Store.Tree(ctx) if err != nil { return ExitError(ctx, ExitList, err, "failed to get store tree: %s", err) }...
go
func (s *Action) Audit(ctx context.Context, c *cli.Context) error { filter := c.Args().First() ctx = s.Store.WithConfig(ctx, filter) out.Print(ctx, "Auditing passwords for common flaws ...") t, err := s.Store.Tree(ctx) if err != nil { return ExitError(ctx, ExitList, err, "failed to get store tree: %s", err) }...
[ "func", "(", "s", "*", "Action", ")", "Audit", "(", "ctx", "context", ".", "Context", ",", "c", "*", "cli", ".", "Context", ")", "error", "{", "filter", ":=", "c", ".", "Args", "(", ")", ".", "First", "(", ")", "\n", "ctx", "=", "s", ".", "St...
// Audit validates passwords against common flaws
[ "Audit", "validates", "passwords", "against", "common", "flaws" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/audit.go#L13-L38
28,936
gopasspw/gopass
pkg/backend/crypto/gpg/cli/gpg.go
New
func New(ctx context.Context, cfg Config) (*GPG, error) { // ensure created files don't have group or world perms set // this setting should be inherited by sub-processes umask(cfg.Umask) // make sure GPG_TTY is set (if possible) if gt := os.Getenv("GPG_TTY"); gt == "" { if t := tty(); t != "" { _ = os.Seten...
go
func New(ctx context.Context, cfg Config) (*GPG, error) { // ensure created files don't have group or world perms set // this setting should be inherited by sub-processes umask(cfg.Umask) // make sure GPG_TTY is set (if possible) if gt := os.Getenv("GPG_TTY"); gt == "" { if t := tty(); t != "" { _ = os.Seten...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "cfg", "Config", ")", "(", "*", "GPG", ",", "error", ")", "{", "// ensure created files don't have group or world perms set", "// this setting should be inherited by sub-processes", "umask", "(", "cfg", ".", "...
// New creates a new GPG wrapper
[ "New", "creates", "a", "new", "GPG", "wrapper" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/gpg.go#L43-L73
28,937
gopasspw/gopass
pkg/backend/crypto/gpg/cli/gpg.go
RecipientIDs
func (g *GPG) RecipientIDs(ctx context.Context, buf []byte) ([]string, error) { _ = os.Setenv("LANGUAGE", "C") recp := make([]string, 0, 5) args := []string{"--batch", "--list-only", "--list-packets", "--no-default-keyring", "--secret-keyring", "/dev/null"} cmd := exec.CommandContext(ctx, g.binary, args...) cmd.S...
go
func (g *GPG) RecipientIDs(ctx context.Context, buf []byte) ([]string, error) { _ = os.Setenv("LANGUAGE", "C") recp := make([]string, 0, 5) args := []string{"--batch", "--list-only", "--list-packets", "--no-default-keyring", "--secret-keyring", "/dev/null"} cmd := exec.CommandContext(ctx, g.binary, args...) cmd.S...
[ "func", "(", "g", "*", "GPG", ")", "RecipientIDs", "(", "ctx", "context", ".", "Context", ",", "buf", "[", "]", "byte", ")", "(", "[", "]", "string", ",", "error", ")", "{", "_", "=", "os", ".", "Setenv", "(", "\"", "\"", ",", "\"", "\"", ")"...
// RecipientIDs returns a list of recipient IDs for a given file
[ "RecipientIDs", "returns", "a", "list", "of", "recipient", "IDs", "for", "a", "given", "file" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/gpg.go#L76-L108
28,938
gopasspw/gopass
pkg/backend/crypto/gpg/cli/gpg.go
Decrypt
func (g *GPG) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) { args := append(g.args, "--decrypt") cmd := exec.CommandContext(ctx, g.binary, args...) cmd.Stdin = bytes.NewReader(ciphertext) cmd.Stderr = os.Stderr out.Debug(ctx, "gpg.Decrypt: %s %+v", cmd.Path, cmd.Args) return cmd.Output() }
go
func (g *GPG) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) { args := append(g.args, "--decrypt") cmd := exec.CommandContext(ctx, g.binary, args...) cmd.Stdin = bytes.NewReader(ciphertext) cmd.Stderr = os.Stderr out.Debug(ctx, "gpg.Decrypt: %s %+v", cmd.Path, cmd.Args) return cmd.Output() }
[ "func", "(", "g", "*", "GPG", ")", "Decrypt", "(", "ctx", "context", ".", "Context", ",", "ciphertext", "[", "]", "byte", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "args", ":=", "append", "(", "g", ".", "args", ",", "\"", "\"", ")", ...
// Decrypt will try to decrypt the given file
[ "Decrypt", "will", "try", "to", "decrypt", "the", "given", "file" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/gpg.go#L137-L145
28,939
gopasspw/gopass
pkg/otp/otp.go
Calculate
func Calculate(ctx context.Context, name string, sec store.Secret) (twofactor.OTP, string, error) { otpURL := "" // check body for _, line := range strings.Split(sec.Body(), "\n") { if strings.HasPrefix(line, "otpauth://") { otpURL = line break } } if otpURL != "" { return twofactor.FromURL(otpURL) } ...
go
func Calculate(ctx context.Context, name string, sec store.Secret) (twofactor.OTP, string, error) { otpURL := "" // check body for _, line := range strings.Split(sec.Body(), "\n") { if strings.HasPrefix(line, "otpauth://") { otpURL = line break } } if otpURL != "" { return twofactor.FromURL(otpURL) } ...
[ "func", "Calculate", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "sec", "store", ".", "Secret", ")", "(", "twofactor", ".", "OTP", ",", "string", ",", "error", ")", "{", "otpURL", ":=", "\"", "\"", "\n", "// check body", "for", ...
// Calculate will compute a OTP code from a given secret
[ "Calculate", "will", "compute", "a", "OTP", "code", "from", "a", "given", "secret" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/otp/otp.go#L15-L42
28,940
gopasspw/gopass
pkg/otp/otp.go
WriteQRFile
func WriteQRFile(ctx context.Context, otp twofactor.OTP, label, file string) error { var qr []byte var err error switch otp.Type() { case twofactor.OATH_HOTP: hotp := otp.(*twofactor.HOTP) qr, err = hotp.QR(label) case twofactor.OATH_TOTP: totp := otp.(*twofactor.TOTP) qr, err = totp.QR(label) default: ...
go
func WriteQRFile(ctx context.Context, otp twofactor.OTP, label, file string) error { var qr []byte var err error switch otp.Type() { case twofactor.OATH_HOTP: hotp := otp.(*twofactor.HOTP) qr, err = hotp.QR(label) case twofactor.OATH_TOTP: totp := otp.(*twofactor.TOTP) qr, err = totp.QR(label) default: ...
[ "func", "WriteQRFile", "(", "ctx", "context", ".", "Context", ",", "otp", "twofactor", ".", "OTP", ",", "label", ",", "file", "string", ")", "error", "{", "var", "qr", "[", "]", "byte", "\n", "var", "err", "error", "\n", "switch", "otp", ".", "Type",...
// WriteQRFile writes the given OTP code as a QR image to disk
[ "WriteQRFile", "writes", "the", "given", "OTP", "code", "as", "a", "QR", "image", "to", "disk" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/otp/otp.go#L45-L66
28,941
gopasspw/gopass
pkg/store/root/recipients.go
ListRecipients
func (r *Store) ListRecipients(ctx context.Context, store string) []string { ctx, sub, _ := r.getStore(ctx, store) return sub.Recipients(ctx) }
go
func (r *Store) ListRecipients(ctx context.Context, store string) []string { ctx, sub, _ := r.getStore(ctx, store) return sub.Recipients(ctx) }
[ "func", "(", "r", "*", "Store", ")", "ListRecipients", "(", "ctx", "context", ".", "Context", ",", "store", "string", ")", "[", "]", "string", "{", "ctx", ",", "sub", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "store", ")", "\n", "ret...
// ListRecipients lists all recipients for the given store
[ "ListRecipients", "lists", "all", "recipients", "for", "the", "given", "store" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L18-L21
28,942
gopasspw/gopass
pkg/store/root/recipients.go
RemoveRecipient
func (r *Store) RemoveRecipient(ctx context.Context, store, rec string) error { ctx, sub, _ := r.getStore(ctx, store) return sub.RemoveRecipient(ctx, rec) }
go
func (r *Store) RemoveRecipient(ctx context.Context, store, rec string) error { ctx, sub, _ := r.getStore(ctx, store) return sub.RemoveRecipient(ctx, rec) }
[ "func", "(", "r", "*", "Store", ")", "RemoveRecipient", "(", "ctx", "context", ".", "Context", ",", "store", ",", "rec", "string", ")", "error", "{", "ctx", ",", "sub", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "store", ")", "\n", "r...
// RemoveRecipient removes a single recipient from the given store
[ "RemoveRecipient", "removes", "a", "single", "recipient", "from", "the", "given", "store" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L30-L33
28,943
gopasspw/gopass
pkg/store/root/recipients.go
ImportMissingPublicKeys
func (r *Store) ImportMissingPublicKeys(ctx context.Context) error { for alias, sub := range r.mounts { ctx := r.cfg.Mounts[alias].WithContext(ctx) if err := sub.ImportMissingPublicKeys(ctx); err != nil { out.Error(ctx, "[%s] Failed to import missing public keys: %s", alias, err) } } return r.store.ImportM...
go
func (r *Store) ImportMissingPublicKeys(ctx context.Context) error { for alias, sub := range r.mounts { ctx := r.cfg.Mounts[alias].WithContext(ctx) if err := sub.ImportMissingPublicKeys(ctx); err != nil { out.Error(ctx, "[%s] Failed to import missing public keys: %s", alias, err) } } return r.store.ImportM...
[ "func", "(", "r", "*", "Store", ")", "ImportMissingPublicKeys", "(", "ctx", "context", ".", "Context", ")", "error", "{", "for", "alias", ",", "sub", ":=", "range", "r", ".", "mounts", "{", "ctx", ":=", "r", ".", "cfg", ".", "Mounts", "[", "alias", ...
// ImportMissingPublicKeys import missing public keys in any substore
[ "ImportMissingPublicKeys", "import", "missing", "public", "keys", "in", "any", "substore" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L53-L62
28,944
gopasspw/gopass
pkg/store/root/recipients.go
RecipientsTree
func (r *Store) RecipientsTree(ctx context.Context, pretty bool) (tree.Tree, error) { root := simple.New("gopass") for _, recp := range r.store.Recipients(ctx) { if err := r.addRecipient(ctx, "", root, recp, pretty); err != nil { color.Yellow("Failed to add recipient to tree %s: %s", recp, err) } } mps := ...
go
func (r *Store) RecipientsTree(ctx context.Context, pretty bool) (tree.Tree, error) { root := simple.New("gopass") for _, recp := range r.store.Recipients(ctx) { if err := r.addRecipient(ctx, "", root, recp, pretty); err != nil { color.Yellow("Failed to add recipient to tree %s: %s", recp, err) } } mps := ...
[ "func", "(", "r", "*", "Store", ")", "RecipientsTree", "(", "ctx", "context", ".", "Context", ",", "pretty", "bool", ")", "(", "tree", ".", "Tree", ",", "error", ")", "{", "root", ":=", "simple", ".", "New", "(", "\"", "\"", ")", "\n\n", "for", "...
// RecipientsTree returns a tree view of all stores' recipients
[ "RecipientsTree", "returns", "a", "tree", "view", "of", "all", "stores", "recipients" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L78-L105
28,945
gopasspw/gopass
pkg/backend/crypto/gpg/openpgp/utils.go
gpgHome
func gpgHome(ctx context.Context) string { if gh := os.Getenv("GNUPGHOME"); gh != "" { return gh } hd, err := homedir.Dir() if err != nil { out.Debug(ctx, "Failed to get homedir: %s", err) return "" } return filepath.Join(hd, ".gnupg") }
go
func gpgHome(ctx context.Context) string { if gh := os.Getenv("GNUPGHOME"); gh != "" { return gh } hd, err := homedir.Dir() if err != nil { out.Debug(ctx, "Failed to get homedir: %s", err) return "" } return filepath.Join(hd, ".gnupg") }
[ "func", "gpgHome", "(", "ctx", "context", ".", "Context", ")", "string", "{", "if", "gh", ":=", "os", ".", "Getenv", "(", "\"", "\"", ")", ";", "gh", "!=", "\"", "\"", "{", "return", "gh", "\n", "}", "\n", "hd", ",", "err", ":=", "homedir", "."...
// gpgHome returns the gnupg homedir
[ "gpgHome", "returns", "the", "gnupg", "homedir" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/utils.go#L115-L125
28,946
gopasspw/gopass
pkg/store/sub/context.go
WithFsckCheck
func WithFsckCheck(ctx context.Context, check bool) context.Context { return context.WithValue(ctx, ctxKeyFsckCheck, check) }
go
func WithFsckCheck(ctx context.Context, check bool) context.Context { return context.WithValue(ctx, ctxKeyFsckCheck, check) }
[ "func", "WithFsckCheck", "(", "ctx", "context", ".", "Context", ",", "check", "bool", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyFsckCheck", ",", "check", ")", "\n", "}" ]
// WithFsckCheck returns a context with the flag for fscks check set
[ "WithFsckCheck", "returns", "a", "context", "with", "the", "flag", "for", "fscks", "check", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L23-L25
28,947
gopasspw/gopass
pkg/store/sub/context.go
HasFsckCheck
func HasFsckCheck(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyFsckCheck).(bool) return ok }
go
func HasFsckCheck(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyFsckCheck).(bool) return ok }
[ "func", "HasFsckCheck", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "_", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyFsckCheck", ")", ".", "(", "bool", ")", "\n", "return", "ok", "\n", "}" ]
// HasFsckCheck returns true if a value for fsck check has been set in this // context
[ "HasFsckCheck", "returns", "true", "if", "a", "value", "for", "fsck", "check", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L29-L32
28,948
gopasspw/gopass
pkg/store/sub/context.go
IsFsckCheck
func IsFsckCheck(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyFsckCheck).(bool) if !ok { return false } return bv }
go
func IsFsckCheck(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyFsckCheck).(bool) if !ok { return false } return bv }
[ "func", "IsFsckCheck", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "bv", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyFsckCheck", ")", ".", "(", "bool", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "return"...
// IsFsckCheck returns the value of fsck check
[ "IsFsckCheck", "returns", "the", "value", "of", "fsck", "check" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L35-L41
28,949
gopasspw/gopass
pkg/store/sub/context.go
WithFsckForce
func WithFsckForce(ctx context.Context, force bool) context.Context { return context.WithValue(ctx, ctxKeyFsckForce, force) }
go
func WithFsckForce(ctx context.Context, force bool) context.Context { return context.WithValue(ctx, ctxKeyFsckForce, force) }
[ "func", "WithFsckForce", "(", "ctx", "context", ".", "Context", ",", "force", "bool", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyFsckForce", ",", "force", ")", "\n", "}" ]
// WithFsckForce returns a context with the flag for fsck force set
[ "WithFsckForce", "returns", "a", "context", "with", "the", "flag", "for", "fsck", "force", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L44-L46
28,950
gopasspw/gopass
pkg/store/sub/context.go
HasFsckForce
func HasFsckForce(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyFsckForce).(bool) return ok }
go
func HasFsckForce(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyFsckForce).(bool) return ok }
[ "func", "HasFsckForce", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "_", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyFsckForce", ")", ".", "(", "bool", ")", "\n", "return", "ok", "\n", "}" ]
// HasFsckForce returns true if a value for fsck force has been set in this // context
[ "HasFsckForce", "returns", "true", "if", "a", "value", "for", "fsck", "force", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L50-L53
28,951
gopasspw/gopass
pkg/store/sub/context.go
IsFsckForce
func IsFsckForce(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyFsckForce).(bool) if !ok { return false } return bv }
go
func IsFsckForce(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyFsckForce).(bool) if !ok { return false } return bv }
[ "func", "IsFsckForce", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "bv", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyFsckForce", ")", ".", "(", "bool", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "}", "\n", "return"...
// IsFsckForce returns the value of fsck force
[ "IsFsckForce", "returns", "the", "value", "of", "fsck", "force" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L56-L62
28,952
gopasspw/gopass
pkg/store/sub/context.go
WithAutoSync
func WithAutoSync(ctx context.Context, sync bool) context.Context { return context.WithValue(ctx, ctxKeyAutoSync, sync) }
go
func WithAutoSync(ctx context.Context, sync bool) context.Context { return context.WithValue(ctx, ctxKeyAutoSync, sync) }
[ "func", "WithAutoSync", "(", "ctx", "context", ".", "Context", ",", "sync", "bool", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyAutoSync", ",", "sync", ")", "\n", "}" ]
// WithAutoSync returns a context with the flag for autosync set
[ "WithAutoSync", "returns", "a", "context", "with", "the", "flag", "for", "autosync", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L65-L67
28,953
gopasspw/gopass
pkg/store/sub/context.go
HasAutoSync
func HasAutoSync(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyAutoSync).(bool) return ok }
go
func HasAutoSync(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyAutoSync).(bool) return ok }
[ "func", "HasAutoSync", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "_", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyAutoSync", ")", ".", "(", "bool", ")", "\n", "return", "ok", "\n", "}" ]
// HasAutoSync has been set if a value for auto sync has been set in this // context
[ "HasAutoSync", "has", "been", "set", "if", "a", "value", "for", "auto", "sync", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L71-L74
28,954
gopasspw/gopass
pkg/store/sub/context.go
IsAutoSync
func IsAutoSync(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyAutoSync).(bool) if !ok { return true } return bv }
go
func IsAutoSync(ctx context.Context) bool { bv, ok := ctx.Value(ctxKeyAutoSync).(bool) if !ok { return true } return bv }
[ "func", "IsAutoSync", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "bv", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyAutoSync", ")", ".", "(", "bool", ")", "\n", "if", "!", "ok", "{", "return", "true", "\n", "}", "\n", "return", ...
// IsAutoSync returns the value of autosync
[ "IsAutoSync", "returns", "the", "value", "of", "autosync" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L77-L83
28,955
gopasspw/gopass
pkg/store/sub/context.go
HasReason
func HasReason(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyReason).(string) return ok }
go
func HasReason(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyReason).(string) return ok }
[ "func", "HasReason", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "_", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyReason", ")", ".", "(", "string", ")", "\n", "return", "ok", "\n", "}" ]
// HasReason returns true if a value for reason has been set in this context
[ "HasReason", "returns", "true", "if", "a", "value", "for", "reason", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L91-L94
28,956
gopasspw/gopass
pkg/store/sub/context.go
GetReason
func GetReason(ctx context.Context) string { sv, ok := ctx.Value(ctxKeyReason).(string) if !ok { return "" } return sv }
go
func GetReason(ctx context.Context) string { sv, ok := ctx.Value(ctxKeyReason).(string) if !ok { return "" } return sv }
[ "func", "GetReason", "(", "ctx", "context", ".", "Context", ")", "string", "{", "sv", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyReason", ")", ".", "(", "string", ")", "\n", "if", "!", "ok", "{", "return", "\"", "\"", "\n", "}", "\n", "ret...
// GetReason returns the value of reason
[ "GetReason", "returns", "the", "value", "of", "reason" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L97-L103
28,957
gopasspw/gopass
pkg/store/sub/context.go
WithImportFunc
func WithImportFunc(ctx context.Context, imf store.ImportCallback) context.Context { return context.WithValue(ctx, ctxKeyImportFunc, imf) }
go
func WithImportFunc(ctx context.Context, imf store.ImportCallback) context.Context { return context.WithValue(ctx, ctxKeyImportFunc, imf) }
[ "func", "WithImportFunc", "(", "ctx", "context", ".", "Context", ",", "imf", "store", ".", "ImportCallback", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyImportFunc", ",", "imf", ")", "\n", "}" ]
// WithImportFunc will return a context with the import callback set
[ "WithImportFunc", "will", "return", "a", "context", "with", "the", "import", "callback", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L106-L108
28,958
gopasspw/gopass
pkg/store/sub/context.go
HasImportFunc
func HasImportFunc(ctx context.Context) bool { imf, ok := ctx.Value(ctxKeyImportFunc).(store.ImportCallback) return ok && imf != nil }
go
func HasImportFunc(ctx context.Context) bool { imf, ok := ctx.Value(ctxKeyImportFunc).(store.ImportCallback) return ok && imf != nil }
[ "func", "HasImportFunc", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "imf", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyImportFunc", ")", ".", "(", "store", ".", "ImportCallback", ")", "\n", "return", "ok", "&&", "imf", "!=", "nil", ...
// HasImportFunc returns true if a value for import func has been set in this // context
[ "HasImportFunc", "returns", "true", "if", "a", "value", "for", "import", "func", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L112-L115
28,959
gopasspw/gopass
pkg/store/sub/context.go
WithRecipientFunc
func WithRecipientFunc(ctx context.Context, imf store.RecipientCallback) context.Context { return context.WithValue(ctx, ctxKeyRecipientFunc, imf) }
go
func WithRecipientFunc(ctx context.Context, imf store.RecipientCallback) context.Context { return context.WithValue(ctx, ctxKeyRecipientFunc, imf) }
[ "func", "WithRecipientFunc", "(", "ctx", "context", ".", "Context", ",", "imf", "store", ".", "RecipientCallback", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyRecipientFunc", ",", "imf", ")", "\n", "}" ...
// WithRecipientFunc will return a context with the recipient callback set
[ "WithRecipientFunc", "will", "return", "a", "context", "with", "the", "recipient", "callback", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L130-L132
28,960
gopasspw/gopass
pkg/store/sub/context.go
HasRecipientFunc
func HasRecipientFunc(ctx context.Context) bool { imf, ok := ctx.Value(ctxKeyRecipientFunc).(store.RecipientCallback) return ok && imf != nil }
go
func HasRecipientFunc(ctx context.Context) bool { imf, ok := ctx.Value(ctxKeyRecipientFunc).(store.RecipientCallback) return ok && imf != nil }
[ "func", "HasRecipientFunc", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "imf", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyRecipientFunc", ")", ".", "(", "store", ".", "RecipientCallback", ")", "\n", "return", "ok", "&&", "imf", "!=", ...
// HasRecipientFunc returns true if a recipient func has been set in this // context
[ "HasRecipientFunc", "returns", "true", "if", "a", "recipient", "func", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L136-L139
28,961
gopasspw/gopass
pkg/store/sub/context.go
WithFsckFunc
func WithFsckFunc(ctx context.Context, imf store.FsckCallback) context.Context { return context.WithValue(ctx, ctxKeyFsckFunc, imf) }
go
func WithFsckFunc(ctx context.Context, imf store.FsckCallback) context.Context { return context.WithValue(ctx, ctxKeyFsckFunc, imf) }
[ "func", "WithFsckFunc", "(", "ctx", "context", ".", "Context", ",", "imf", "store", ".", "FsckCallback", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyFsckFunc", ",", "imf", ")", "\n", "}" ]
// WithFsckFunc will return a context with the fsck confirmation callback set
[ "WithFsckFunc", "will", "return", "a", "context", "with", "the", "fsck", "confirmation", "callback", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L155-L157
28,962
gopasspw/gopass
pkg/store/sub/context.go
HasFsckFunc
func HasFsckFunc(ctx context.Context) bool { imf, ok := ctx.Value(ctxKeyFsckFunc).(store.FsckCallback) return ok && imf != nil }
go
func HasFsckFunc(ctx context.Context) bool { imf, ok := ctx.Value(ctxKeyFsckFunc).(store.FsckCallback) return ok && imf != nil }
[ "func", "HasFsckFunc", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "imf", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyFsckFunc", ")", ".", "(", "store", ".", "FsckCallback", ")", "\n", "return", "ok", "&&", "imf", "!=", "nil", "\n"...
// HasFsckFunc returns true if a fsck func has been set in this context
[ "HasFsckFunc", "returns", "true", "if", "a", "fsck", "func", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L160-L163
28,963
gopasspw/gopass
pkg/store/sub/context.go
WithCheckRecipients
func WithCheckRecipients(ctx context.Context, cr bool) context.Context { return context.WithValue(ctx, ctxKeyCheckRecipients, cr) }
go
func WithCheckRecipients(ctx context.Context, cr bool) context.Context { return context.WithValue(ctx, ctxKeyCheckRecipients, cr) }
[ "func", "WithCheckRecipients", "(", "ctx", "context", ".", "Context", ",", "cr", "bool", ")", "context", ".", "Context", "{", "return", "context", ".", "WithValue", "(", "ctx", ",", "ctxKeyCheckRecipients", ",", "cr", ")", "\n", "}" ]
// WithCheckRecipients will return a context with the flag for check recipients // set
[ "WithCheckRecipients", "will", "return", "a", "context", "with", "the", "flag", "for", "check", "recipients", "set" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L180-L182
28,964
gopasspw/gopass
pkg/store/sub/context.go
HasCheckRecipients
func HasCheckRecipients(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyCheckRecipients).(bool) return ok }
go
func HasCheckRecipients(ctx context.Context) bool { _, ok := ctx.Value(ctxKeyCheckRecipients).(bool) return ok }
[ "func", "HasCheckRecipients", "(", "ctx", "context", ".", "Context", ")", "bool", "{", "_", ",", "ok", ":=", "ctx", ".", "Value", "(", "ctxKeyCheckRecipients", ")", ".", "(", "bool", ")", "\n", "return", "ok", "\n", "}" ]
// HasCheckRecipients returns true if check recipients has been set in this // context
[ "HasCheckRecipients", "returns", "true", "if", "check", "recipients", "has", "been", "set", "in", "this", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L186-L189
28,965
gopasspw/gopass
pkg/tempfile/file.go
New
func New(ctx context.Context, prefix string) (*File, error) { td, err := ioutil.TempDir(tempdirBase(), prefix) if err != nil { return nil, err } tf := &File{ dir: td, dbg: ctxutil.IsDebug(ctx), } if err := tf.mount(ctx); err != nil { _ = os.RemoveAll(tf.dir) return nil, err } fn := filepath.Join(tf...
go
func New(ctx context.Context, prefix string) (*File, error) { td, err := ioutil.TempDir(tempdirBase(), prefix) if err != nil { return nil, err } tf := &File{ dir: td, dbg: ctxutil.IsDebug(ctx), } if err := tf.mount(ctx); err != nil { _ = os.RemoveAll(tf.dir) return nil, err } fn := filepath.Join(tf...
[ "func", "New", "(", "ctx", "context", ".", "Context", ",", "prefix", "string", ")", "(", "*", "File", ",", "error", ")", "{", "td", ",", "err", ":=", "ioutil", ".", "TempDir", "(", "tempdirBase", "(", ")", ",", "prefix", ")", "\n", "if", "err", "...
// New returns a new tempfile wrapper
[ "New", "returns", "a", "new", "tempfile", "wrapper" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L23-L47
28,966
gopasspw/gopass
pkg/tempfile/file.go
Name
func (t *File) Name() string { if t.fh == nil { return "" } return t.fh.Name() }
go
func (t *File) Name() string { if t.fh == nil { return "" } return t.fh.Name() }
[ "func", "(", "t", "*", "File", ")", "Name", "(", ")", "string", "{", "if", "t", ".", "fh", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "t", ".", "fh", ".", "Name", "(", ")", "\n", "}" ]
// Name returns the name of the tempfile
[ "Name", "returns", "the", "name", "of", "the", "tempfile" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L50-L55
28,967
gopasspw/gopass
pkg/tempfile/file.go
Write
func (t *File) Write(p []byte) (int, error) { if t.fh == nil { return 0, errors.Errorf("not initialized") } return t.fh.Write(p) }
go
func (t *File) Write(p []byte) (int, error) { if t.fh == nil { return 0, errors.Errorf("not initialized") } return t.fh.Write(p) }
[ "func", "(", "t", "*", "File", ")", "Write", "(", "p", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "if", "t", ".", "fh", "==", "nil", "{", "return", "0", ",", "errors", ".", "Errorf", "(", "\"", "\"", ")", "\n", "}", "\n", ...
// Write implement io.Writer
[ "Write", "implement", "io", ".", "Writer" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L58-L63
28,968
gopasspw/gopass
pkg/tempfile/file.go
Close
func (t *File) Close() error { if t.fh == nil { return nil } return t.fh.Close() }
go
func (t *File) Close() error { if t.fh == nil { return nil } return t.fh.Close() }
[ "func", "(", "t", "*", "File", ")", "Close", "(", ")", "error", "{", "if", "t", ".", "fh", "==", "nil", "{", "return", "nil", "\n", "}", "\n", "return", "t", ".", "fh", ".", "Close", "(", ")", "\n", "}" ]
// Close implements io.WriteCloser
[ "Close", "implements", "io", ".", "WriteCloser" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L66-L71
28,969
gopasspw/gopass
pkg/tempfile/file.go
Remove
func (t *File) Remove(ctx context.Context) error { _ = t.Close() if err := t.unmount(ctx); err != nil { return errors.Errorf("Failed to unmount %s from %s: %s", t.dev, t.dir, err) } if t.dir == "" { return nil } return os.RemoveAll(t.dir) }
go
func (t *File) Remove(ctx context.Context) error { _ = t.Close() if err := t.unmount(ctx); err != nil { return errors.Errorf("Failed to unmount %s from %s: %s", t.dev, t.dir, err) } if t.dir == "" { return nil } return os.RemoveAll(t.dir) }
[ "func", "(", "t", "*", "File", ")", "Remove", "(", "ctx", "context", ".", "Context", ")", "error", "{", "_", "=", "t", ".", "Close", "(", ")", "\n", "if", "err", ":=", "t", ".", "unmount", "(", "ctx", ")", ";", "err", "!=", "nil", "{", "retur...
// Remove attempts to remove the tempfile
[ "Remove", "attempts", "to", "remove", "the", "tempfile" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L74-L83
28,970
gopasspw/gopass
pkg/jsonapi/manifest/setup_windows.go
GetRegistryPath
func GetRegistryPath(browser string) (string, error) { path, found := registryPaths[browser] if !found { return "", fmt.Errorf("browser %s on %s is currently not supported", browser, runtime.GOOS) } return path, nil }
go
func GetRegistryPath(browser string) (string, error) { path, found := registryPaths[browser] if !found { return "", fmt.Errorf("browser %s on %s is currently not supported", browser, runtime.GOOS) } return path, nil }
[ "func", "GetRegistryPath", "(", "browser", "string", ")", "(", "string", ",", "error", ")", "{", "path", ",", "found", ":=", "registryPaths", "[", "browser", "]", "\n", "if", "!", "found", "{", "return", "\"", "\"", ",", "fmt", ".", "Errorf", "(", "\...
// GetRegistryPath returns the relative registry path to use in the windows registry key
[ "GetRegistryPath", "returns", "the", "relative", "registry", "path", "to", "use", "in", "the", "windows", "registry", "key" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_windows.go#L40-L46
28,971
gopasspw/gopass
pkg/store/sub/fsck.go
Fsck
func (s *Store) Fsck(ctx context.Context, path string) error { ctx = out.AddPrefix(ctx, "["+s.alias+"] ") out.Debug(ctx, "Fsck(%s)", path) // first let the storage backend check itself if err := s.storage.Fsck(ctx); err != nil { return errors.Wrapf(err, "storage backend found errors: %s", err) } pcb := ctxuti...
go
func (s *Store) Fsck(ctx context.Context, path string) error { ctx = out.AddPrefix(ctx, "["+s.alias+"] ") out.Debug(ctx, "Fsck(%s)", path) // first let the storage backend check itself if err := s.storage.Fsck(ctx); err != nil { return errors.Wrapf(err, "storage backend found errors: %s", err) } pcb := ctxuti...
[ "func", "(", "s", "*", "Store", ")", "Fsck", "(", "ctx", "context", ".", "Context", ",", "path", "string", ")", "error", "{", "ctx", "=", "out", ".", "AddPrefix", "(", "ctx", ",", "\"", "\"", "+", "s", ".", "alias", "+", "\"", "\"", ")", "\n", ...
// Fsck checks all entries matching the given prefix
[ "Fsck", "checks", "all", "entries", "matching", "the", "given", "prefix" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/fsck.go#L15-L45
28,972
gopasspw/gopass
pkg/config/context.go
WithContext
func (c StoreConfig) WithContext(ctx context.Context) context.Context { if !ctxutil.HasAskForMore(ctx) { ctx = ctxutil.WithAskForMore(ctx, c.AskForMore) } if !ctxutil.HasAutoClip(ctx) { ctx = ctxutil.WithAutoClip(ctx, c.AutoClip) } if !c.AutoImport { ctx = sub.WithImportFunc(ctx, nil) } if !sub.HasAutoSync...
go
func (c StoreConfig) WithContext(ctx context.Context) context.Context { if !ctxutil.HasAskForMore(ctx) { ctx = ctxutil.WithAskForMore(ctx, c.AskForMore) } if !ctxutil.HasAutoClip(ctx) { ctx = ctxutil.WithAutoClip(ctx, c.AutoClip) } if !c.AutoImport { ctx = sub.WithImportFunc(ctx, nil) } if !sub.HasAutoSync...
[ "func", "(", "c", "StoreConfig", ")", "WithContext", "(", "ctx", "context", ".", "Context", ")", "context", ".", "Context", "{", "if", "!", "ctxutil", ".", "HasAskForMore", "(", "ctx", ")", "{", "ctx", "=", "ctxutil", ".", "WithAskForMore", "(", "ctx", ...
// WithContext returns a context with all config options set for this store // config, iff they have not been already set in the context
[ "WithContext", "returns", "a", "context", "with", "all", "config", "options", "set", "for", "this", "store", "config", "iff", "they", "have", "not", "been", "already", "set", "in", "the", "context" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/context.go#L12-L47
28,973
gopasspw/gopass
pkg/jsonapi/manifest/setup_others.go
ValidBrowser
func ValidBrowser(name string) bool { _, found := manifestPath[runtime.GOOS][name] return found }
go
func ValidBrowser(name string) bool { _, found := manifestPath[runtime.GOOS][name] return found }
[ "func", "ValidBrowser", "(", "name", "string", ")", "bool", "{", "_", ",", "found", ":=", "manifestPath", "[", "runtime", ".", "GOOS", "]", "[", "name", "]", "\n", "return", "found", "\n", "}" ]
// ValidBrowser returns true if the given browser is supported on this platform
[ "ValidBrowser", "returns", "true", "if", "the", "given", "browser", "is", "supported", "on", "this", "platform" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_others.go#L46-L49
28,974
gopasspw/gopass
pkg/jsonapi/manifest/setup_others.go
Path
func Path(browser, libpath string, globalInstall bool) (string, error) { location, err := getLocation(browser, libpath, globalInstall) if err != nil { return "", err } expanded, err := homedir.Expand(location) if err != nil { return "", err } return filepath.Join(expanded, Name+".json"), nil }
go
func Path(browser, libpath string, globalInstall bool) (string, error) { location, err := getLocation(browser, libpath, globalInstall) if err != nil { return "", err } expanded, err := homedir.Expand(location) if err != nil { return "", err } return filepath.Join(expanded, Name+".json"), nil }
[ "func", "Path", "(", "browser", ",", "libpath", "string", ",", "globalInstall", "bool", ")", "(", "string", ",", "error", ")", "{", "location", ",", "err", ":=", "getLocation", "(", "browser", ",", "libpath", ",", "globalInstall", ")", "\n", "if", "err",...
// Path returns the manifest file path
[ "Path", "returns", "the", "manifest", "file", "path" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_others.go#L62-L74
28,975
gopasspw/gopass
pkg/jsonapi/manifest/setup_others.go
getLocation
func getLocation(browser, libpath string, globalInstall bool) (string, error) { if globalInstall { return getGlobalLocation(browser, libpath) } pm, found := manifestPath[runtime.GOOS] if !found { return "", fmt.Errorf("platform %s is currently not supported", runtime.GOOS) } path, found := pm[browser] if !f...
go
func getLocation(browser, libpath string, globalInstall bool) (string, error) { if globalInstall { return getGlobalLocation(browser, libpath) } pm, found := manifestPath[runtime.GOOS] if !found { return "", fmt.Errorf("platform %s is currently not supported", runtime.GOOS) } path, found := pm[browser] if !f...
[ "func", "getLocation", "(", "browser", ",", "libpath", "string", ",", "globalInstall", "bool", ")", "(", "string", ",", "error", ")", "{", "if", "globalInstall", "{", "return", "getGlobalLocation", "(", "browser", ",", "libpath", ")", "\n", "}", "\n\n", "p...
// getLocation returns only the manifest path
[ "getLocation", "returns", "only", "the", "manifest", "path" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_others.go#L77-L91
28,976
gopasspw/gopass
pkg/store/root/store.go
Path
func (r *Store) Path() string { if r.url == nil { return "" } return r.url.Path }
go
func (r *Store) Path() string { if r.url == nil { return "" } return r.url.Path }
[ "func", "(", "r", "*", "Store", ")", "Path", "(", ")", "string", "{", "if", "r", ".", "url", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "r", ".", "url", ".", "Path", "\n", "}" ]
// Path returns the store path
[ "Path", "returns", "the", "store", "path" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/store.go#L66-L71
28,977
gopasspw/gopass
pkg/store/root/store.go
URL
func (r *Store) URL() string { if r.url == nil { return "" } return r.url.String() }
go
func (r *Store) URL() string { if r.url == nil { return "" } return r.url.String() }
[ "func", "(", "r", "*", "Store", ")", "URL", "(", ")", "string", "{", "if", "r", ".", "url", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n", "return", "r", ".", "url", ".", "String", "(", ")", "\n", "}" ]
// URL returns the store URL
[ "URL", "returns", "the", "store", "URL" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/store.go#L74-L79
28,978
gopasspw/gopass
pkg/store/root/store.go
Storage
func (r *Store) Storage(ctx context.Context, name string) backend.Storage { _, sub, _ := r.getStore(ctx, name) if sub == nil || !sub.Valid() { return nil } return sub.Storage() }
go
func (r *Store) Storage(ctx context.Context, name string) backend.Storage { _, sub, _ := r.getStore(ctx, name) if sub == nil || !sub.Valid() { return nil } return sub.Storage() }
[ "func", "(", "r", "*", "Store", ")", "Storage", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "backend", ".", "Storage", "{", "_", ",", "sub", ",", "_", ":=", "r", ".", "getStore", "(", "ctx", ",", "name", ")", "\n", "if", ...
// Storage returns the storage backend for the given mount point
[ "Storage", "returns", "the", "storage", "backend", "for", "the", "given", "mount", "point" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/store.go#L87-L93
28,979
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
New
func New(host, prefix, datacenter, token string) (*Store, error) { if !strings.HasSuffix(prefix, "/") { prefix += "/" } if strings.HasPrefix(prefix, "/") { prefix = strings.TrimPrefix(prefix, "/") } client, err := api.NewClient(&api.Config{ Address: host, Datacenter: datacenter, Token: token, })...
go
func New(host, prefix, datacenter, token string) (*Store, error) { if !strings.HasSuffix(prefix, "/") { prefix += "/" } if strings.HasPrefix(prefix, "/") { prefix = strings.TrimPrefix(prefix, "/") } client, err := api.NewClient(&api.Config{ Address: host, Datacenter: datacenter, Token: token, })...
[ "func", "New", "(", "host", ",", "prefix", ",", "datacenter", ",", "token", "string", ")", "(", "*", "Store", ",", "error", ")", "{", "if", "!", "strings", ".", "HasSuffix", "(", "prefix", ",", "\"", "\"", ")", "{", "prefix", "+=", "\"", "\"", "\...
// New creates a new consul store
[ "New", "creates", "a", "new", "consul", "store" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L21-L40
28,980
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
Get
func (s *Store) Get(ctx context.Context, name string) ([]byte, error) { name = s.prefix + name out.Debug(ctx, "consul.Get(%s)", name) p, _, err := s.api.KV().Get(name, nil) if err != nil { return nil, err } if p == nil || p.Value == nil { return nil, nil } return p.Value, nil }
go
func (s *Store) Get(ctx context.Context, name string) ([]byte, error) { name = s.prefix + name out.Debug(ctx, "consul.Get(%s)", name) p, _, err := s.api.KV().Get(name, nil) if err != nil { return nil, err } if p == nil || p.Value == nil { return nil, nil } return p.Value, nil }
[ "func", "(", "s", "*", "Store", ")", "Get", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "name", "=", "s", ".", "prefix", "+", "name", "\n", "out", ".", "Debug", "(", "ctx", ...
// Get retrieves a single entry
[ "Get", "retrieves", "a", "single", "entry" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L43-L54
28,981
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
Set
func (s *Store) Set(ctx context.Context, name string, value []byte) error { name = s.prefix + name out.Debug(ctx, "consul.Set(%s)", name) p := &api.KVPair{ Key: name, Value: value, } _, err := s.api.KV().Put(p, nil) return err }
go
func (s *Store) Set(ctx context.Context, name string, value []byte) error { name = s.prefix + name out.Debug(ctx, "consul.Set(%s)", name) p := &api.KVPair{ Key: name, Value: value, } _, err := s.api.KV().Put(p, nil) return err }
[ "func", "(", "s", "*", "Store", ")", "Set", "(", "ctx", "context", ".", "Context", ",", "name", "string", ",", "value", "[", "]", "byte", ")", "error", "{", "name", "=", "s", ".", "prefix", "+", "name", "\n", "out", ".", "Debug", "(", "ctx", ",...
// Set writes a single entry
[ "Set", "writes", "a", "single", "entry" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L57-L66
28,982
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
Exists
func (s *Store) Exists(ctx context.Context, name string) bool { out.Debug(ctx, "consul.Exists(%s)", name) v, err := s.Get(ctx, name) if err == nil && v != nil { return true } return false }
go
func (s *Store) Exists(ctx context.Context, name string) bool { out.Debug(ctx, "consul.Exists(%s)", name) v, err := s.Get(ctx, name) if err == nil && v != nil { return true } return false }
[ "func", "(", "s", "*", "Store", ")", "Exists", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "bool", "{", "out", ".", "Debug", "(", "ctx", ",", "\"", "\"", ",", "name", ")", "\n", "v", ",", "err", ":=", "s", ".", "Get", "...
// Exists checks if a given entry exists
[ "Exists", "checks", "if", "a", "given", "entry", "exists" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L77-L84
28,983
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
List
func (s *Store) List(ctx context.Context, _ string) ([]string, error) { prefix := s.prefix out.Debug(ctx, "consul.List(%s)", prefix) pairs, _, err := s.api.KV().List(prefix, nil) if err != nil { return nil, err } res := make([]string, len(pairs)) for _, kvp := range pairs { res = append(res, strings.TrimPref...
go
func (s *Store) List(ctx context.Context, _ string) ([]string, error) { prefix := s.prefix out.Debug(ctx, "consul.List(%s)", prefix) pairs, _, err := s.api.KV().List(prefix, nil) if err != nil { return nil, err } res := make([]string, len(pairs)) for _, kvp := range pairs { res = append(res, strings.TrimPref...
[ "func", "(", "s", "*", "Store", ")", "List", "(", "ctx", "context", ".", "Context", ",", "_", "string", ")", "(", "[", "]", "string", ",", "error", ")", "{", "prefix", ":=", "s", ".", "prefix", "\n", "out", ".", "Debug", "(", "ctx", ",", "\"", ...
// List lists all entries matching the given prefix
[ "List", "lists", "all", "entries", "matching", "the", "given", "prefix" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L87-L99
28,984
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
IsDir
func (s *Store) IsDir(ctx context.Context, name string) bool { name = s.prefix + name out.Debug(ctx, "consul.IsDir(%s)", name) count := 0 ls, err := s.List(ctx, name) if err != nil { return false } for _, e := range ls { if strings.HasPrefix(e, name) { count++ } } return count > 1 }
go
func (s *Store) IsDir(ctx context.Context, name string) bool { name = s.prefix + name out.Debug(ctx, "consul.IsDir(%s)", name) count := 0 ls, err := s.List(ctx, name) if err != nil { return false } for _, e := range ls { if strings.HasPrefix(e, name) { count++ } } return count > 1 }
[ "func", "(", "s", "*", "Store", ")", "IsDir", "(", "ctx", "context", ".", "Context", ",", "name", "string", ")", "bool", "{", "name", "=", "s", ".", "prefix", "+", "name", "\n", "out", ".", "Debug", "(", "ctx", ",", "\"", "\"", ",", "name", ")"...
// IsDir checks if the given entry is a directory
[ "IsDir", "checks", "if", "the", "given", "entry", "is", "a", "directory" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L102-L116
28,985
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
Prune
func (s *Store) Prune(ctx context.Context, prefix string) error { prefix = s.prefix + prefix out.Debug(ctx, "consul.Prune(%s)", prefix) return s.Delete(ctx, prefix) }
go
func (s *Store) Prune(ctx context.Context, prefix string) error { prefix = s.prefix + prefix out.Debug(ctx, "consul.Prune(%s)", prefix) return s.Delete(ctx, prefix) }
[ "func", "(", "s", "*", "Store", ")", "Prune", "(", "ctx", "context", ".", "Context", ",", "prefix", "string", ")", "error", "{", "prefix", "=", "s", ".", "prefix", "+", "prefix", "\n", "out", ".", "Debug", "(", "ctx", ",", "\"", "\"", ",", "prefi...
// Prune removes the given tree
[ "Prune", "removes", "the", "given", "tree" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L119-L123
28,986
gopasspw/gopass
pkg/backend/storage/kv/consul/store.go
Version
func (s *Store) Version(context.Context) semver.Version { return semver.Version{Major: 1} }
go
func (s *Store) Version(context.Context) semver.Version { return semver.Version{Major: 1} }
[ "func", "(", "s", "*", "Store", ")", "Version", "(", "context", ".", "Context", ")", "semver", ".", "Version", "{", "return", "semver", ".", "Version", "{", "Major", ":", "1", "}", "\n", "}" ]
// Version returns 1.0.0
[ "Version", "returns", "1", ".", "0", ".", "0" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/kv/consul/store.go#L131-L133
28,987
gopasspw/gopass
pkg/backend/storage/fs/fsck.go
Fsck
func (s *Store) Fsck(ctx context.Context) error { pcb := ctxutil.GetProgressCallback(ctx) entries, err := s.List(ctx, "") if err != nil { return err } dirs := make(map[string]struct{}, len(entries)) for _, entry := range entries { pcb() out.Debug(ctx, "file.Fsck() - Checking %s", entry) filename := file...
go
func (s *Store) Fsck(ctx context.Context) error { pcb := ctxutil.GetProgressCallback(ctx) entries, err := s.List(ctx, "") if err != nil { return err } dirs := make(map[string]struct{}, len(entries)) for _, entry := range entries { pcb() out.Debug(ctx, "file.Fsck() - Checking %s", entry) filename := file...
[ "func", "(", "s", "*", "Store", ")", "Fsck", "(", "ctx", "context", ".", "Context", ")", "error", "{", "pcb", ":=", "ctxutil", ".", "GetProgressCallback", "(", "ctx", ")", "\n\n", "entries", ",", "err", ":=", "s", ".", "List", "(", "ctx", ",", "\""...
// Fsck checks the storage integrity
[ "Fsck", "checks", "the", "storage", "integrity" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/storage/fs/fsck.go#L15-L41
28,988
gopasspw/gopass
pkg/config/legacy.go
StoreConfig
func (c *Pre182StoreConfig) StoreConfig() *StoreConfig { sc := &StoreConfig{ AskForMore: c.AskForMore, AutoClip: c.AutoClip, AutoImport: c.AutoImport, AutoSync: c.AutoSync, CheckRecpHash: c.CheckRecpHash, ClipTimeout: c.ClipTimeout, Concurrency: c.Concurrency, EditRecipients:...
go
func (c *Pre182StoreConfig) StoreConfig() *StoreConfig { sc := &StoreConfig{ AskForMore: c.AskForMore, AutoClip: c.AutoClip, AutoImport: c.AutoImport, AutoSync: c.AutoSync, CheckRecpHash: c.CheckRecpHash, ClipTimeout: c.ClipTimeout, Concurrency: c.Concurrency, EditRecipients:...
[ "func", "(", "c", "*", "Pre182StoreConfig", ")", "StoreConfig", "(", ")", "*", "StoreConfig", "{", "sc", ":=", "&", "StoreConfig", "{", "AskForMore", ":", "c", ".", "AskForMore", ",", "AutoClip", ":", "c", ".", "AutoClip", ",", "AutoImport", ":", "c", ...
// StoreConfig returns a current StoreConfig
[ "StoreConfig", "returns", "a", "current", "StoreConfig" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/legacy.go#L37-L57
28,989
gopasspw/gopass
pkg/store/secret/secret.go
New
func New(password, body string) *Secret { return &Secret{ password: password, body: body, } }
go
func New(password, body string) *Secret { return &Secret{ password: password, body: body, } }
[ "func", "New", "(", "password", ",", "body", "string", ")", "*", "Secret", "{", "return", "&", "Secret", "{", "password", ":", "password", ",", "body", ":", "body", ",", "}", "\n", "}" ]
// New creates a new secret
[ "New", "creates", "a", "new", "secret" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L30-L35
28,990
gopasspw/gopass
pkg/store/secret/secret.go
Parse
func Parse(buf []byte) (*Secret, error) { s := &Secret{} lines := bytes.SplitN(buf, []byte("\n"), 2) if len(lines) > 0 { s.password = string(bytes.TrimSpace(lines[0])) } if len(lines) > 1 { s.body = string(bytes.TrimSpace(lines[1])) } if err := s.decode(); err != nil { return s, err } return s, nil }
go
func Parse(buf []byte) (*Secret, error) { s := &Secret{} lines := bytes.SplitN(buf, []byte("\n"), 2) if len(lines) > 0 { s.password = string(bytes.TrimSpace(lines[0])) } if len(lines) > 1 { s.body = string(bytes.TrimSpace(lines[1])) } if err := s.decode(); err != nil { return s, err } return s, nil }
[ "func", "Parse", "(", "buf", "[", "]", "byte", ")", "(", "*", "Secret", ",", "error", ")", "{", "s", ":=", "&", "Secret", "{", "}", "\n", "lines", ":=", "bytes", ".", "SplitN", "(", "buf", ",", "[", "]", "byte", "(", "\"", "\\n", "\"", ")", ...
// Parse decodes an secret. It will always return a valid secret. If decoding // the body to YAML is may return an error which can be ignored.
[ "Parse", "decodes", "an", "secret", ".", "It", "will", "always", "return", "a", "valid", "secret", ".", "If", "decoding", "the", "body", "to", "YAML", "is", "may", "return", "an", "error", "which", "can", "be", "ignored", "." ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L39-L52
28,991
gopasspw/gopass
pkg/store/secret/secret.go
Bytes
func (s *Secret) Bytes() ([]byte, error) { buf := &bytes.Buffer{} _, _ = buf.WriteString(s.password) if s.body != "" { _, _ = buf.WriteString("\n") _, _ = buf.WriteString(s.body) } return buf.Bytes(), nil }
go
func (s *Secret) Bytes() ([]byte, error) { buf := &bytes.Buffer{} _, _ = buf.WriteString(s.password) if s.body != "" { _, _ = buf.WriteString("\n") _, _ = buf.WriteString(s.body) } return buf.Bytes(), nil }
[ "func", "(", "s", "*", "Secret", ")", "Bytes", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "buf", ":=", "&", "bytes", ".", "Buffer", "{", "}", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "s", ".", "password", ")", ...
// Bytes encodes an secret
[ "Bytes", "encodes", "an", "secret" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L55-L63
28,992
gopasspw/gopass
pkg/store/secret/secret.go
String
func (s *Secret) String() string { var buf strings.Builder _, _ = buf.WriteString(s.password) if s.body != "" { _, _ = buf.WriteString("\n") _, _ = buf.WriteString(s.body) } return buf.String() }
go
func (s *Secret) String() string { var buf strings.Builder _, _ = buf.WriteString(s.password) if s.body != "" { _, _ = buf.WriteString("\n") _, _ = buf.WriteString(s.body) } return buf.String() }
[ "func", "(", "s", "*", "Secret", ")", "String", "(", ")", "string", "{", "var", "buf", "strings", ".", "Builder", "\n", "_", ",", "_", "=", "buf", ".", "WriteString", "(", "s", ".", "password", ")", "\n\n", "if", "s", ".", "body", "!=", "\"", "...
// String encodes and returns a string representation of a secret
[ "String", "encodes", "and", "returns", "a", "string", "representation", "of", "a", "secret" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L66-L76
28,993
gopasspw/gopass
pkg/store/secret/secret.go
Password
func (s *Secret) Password() string { s.Lock() defer s.Unlock() return s.password }
go
func (s *Secret) Password() string { s.Lock() defer s.Unlock() return s.password }
[ "func", "(", "s", "*", "Secret", ")", "Password", "(", ")", "string", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "return", "s", ".", "password", "\n", "}" ]
// Password returns the first line from a secret
[ "Password", "returns", "the", "first", "line", "from", "a", "secret" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L79-L84
28,994
gopasspw/gopass
pkg/store/secret/secret.go
Body
func (s *Secret) Body() string { s.Lock() defer s.Unlock() return s.body }
go
func (s *Secret) Body() string { s.Lock() defer s.Unlock() return s.body }
[ "func", "(", "s", "*", "Secret", ")", "Body", "(", ")", "string", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "return", "s", ".", "body", "\n", "}" ]
// Body returns the body of a secret. If the body was valid YAML it returns an // empty string
[ "Body", "returns", "the", "body", "of", "a", "secret", ".", "If", "the", "body", "was", "valid", "YAML", "it", "returns", "an", "empty", "string" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L96-L101
28,995
gopasspw/gopass
pkg/store/secret/secret.go
Data
func (s *Secret) Data() map[string]interface{} { s.Lock() defer s.Unlock() return s.data }
go
func (s *Secret) Data() map[string]interface{} { s.Lock() defer s.Unlock() return s.data }
[ "func", "(", "s", "*", "Secret", ")", "Data", "(", ")", "map", "[", "string", "]", "interface", "{", "}", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "return", "s", ".", "data", "\n", "}" ]
// Data returns the data of a secret. Unless the body was valid YAML, it returns // an map
[ "Data", "returns", "the", "data", "of", "a", "secret", ".", "Unless", "the", "body", "was", "valid", "YAML", "it", "returns", "an", "map" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L105-L110
28,996
gopasspw/gopass
pkg/store/secret/secret.go
SetBody
func (s *Secret) SetBody(b string) error { s.Lock() defer s.Unlock() s.body = b s.data = nil err := s.decode() return err }
go
func (s *Secret) SetBody(b string) error { s.Lock() defer s.Unlock() s.body = b s.data = nil err := s.decode() return err }
[ "func", "(", "s", "*", "Secret", ")", "SetBody", "(", "b", "string", ")", "error", "{", "s", ".", "Lock", "(", ")", "\n", "defer", "s", ".", "Unlock", "(", ")", "\n\n", "s", ".", "body", "=", "b", "\n", "s", ".", "data", "=", "nil", "\n\n", ...
// SetBody sets a new body possibly erasing an decoded YAML map
[ "SetBody", "sets", "a", "new", "body", "possibly", "erasing", "an", "decoded", "YAML", "map" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L113-L122
28,997
gopasspw/gopass
pkg/store/secret/secret.go
Equal
func (s *Secret) Equal(other store.Secret) bool { if s == nil && (other == nil || reflect.ValueOf(other).IsNil()) { return true } if s == nil || other == nil || reflect.ValueOf(other).IsNil() { return false } s.Lock() defer s.Unlock() if s.password != other.Password() { return false } if s.body != oth...
go
func (s *Secret) Equal(other store.Secret) bool { if s == nil && (other == nil || reflect.ValueOf(other).IsNil()) { return true } if s == nil || other == nil || reflect.ValueOf(other).IsNil() { return false } s.Lock() defer s.Unlock() if s.password != other.Password() { return false } if s.body != oth...
[ "func", "(", "s", "*", "Secret", ")", "Equal", "(", "other", "store", ".", "Secret", ")", "bool", "{", "if", "s", "==", "nil", "&&", "(", "other", "==", "nil", "||", "reflect", ".", "ValueOf", "(", "other", ")", ".", "IsNil", "(", ")", ")", "{"...
// Equal returns true if two secrets are equal
[ "Equal", "returns", "true", "if", "two", "secrets", "are", "equal" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/secret.go#L125-L145
28,998
gopasspw/gopass
pkg/pwgen/xkcdgen/pwgen.go
RandomLength
func RandomLength(length int, lang string) (string, error) { return RandomLengthDelim(length, " ", lang) }
go
func RandomLength(length int, lang string) (string, error) { return RandomLengthDelim(length, " ", lang) }
[ "func", "RandomLength", "(", "length", "int", ",", "lang", "string", ")", "(", "string", ",", "error", ")", "{", "return", "RandomLengthDelim", "(", "length", ",", "\"", "\"", ",", "lang", ")", "\n", "}" ]
// RandomLength returns a random passphrase combined from the desired number // of words
[ "RandomLength", "returns", "a", "random", "passphrase", "combined", "from", "the", "desired", "number", "of", "words" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pwgen/xkcdgen/pwgen.go#L13-L15
28,999
gopasspw/gopass
pkg/pwgen/xkcdgen/pwgen.go
RandomLengthDelim
func RandomLengthDelim(length int, delim, lang string) (string, error) { g := xkcdpwgen.NewGenerator() g.SetNumWords(length) g.SetDelimiter(delim) g.SetCapitalize(delim == "") if err := g.UseLangWordlist(lang); err != nil { return "", err } return string(g.GeneratePassword()), nil }
go
func RandomLengthDelim(length int, delim, lang string) (string, error) { g := xkcdpwgen.NewGenerator() g.SetNumWords(length) g.SetDelimiter(delim) g.SetCapitalize(delim == "") if err := g.UseLangWordlist(lang); err != nil { return "", err } return string(g.GeneratePassword()), nil }
[ "func", "RandomLengthDelim", "(", "length", "int", ",", "delim", ",", "lang", "string", ")", "(", "string", ",", "error", ")", "{", "g", ":=", "xkcdpwgen", ".", "NewGenerator", "(", ")", "\n", "g", ".", "SetNumWords", "(", "length", ")", "\n", "g", "...
// RandomLengthDelim returns a random passphrase combined from the desired number // of words and the given delimiter. Words are drawn from lang
[ "RandomLengthDelim", "returns", "a", "random", "passphrase", "combined", "from", "the", "desired", "number", "of", "words", "and", "the", "given", "delimiter", ".", "Words", "are", "drawn", "from", "lang" ]
fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4
https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pwgen/xkcdgen/pwgen.go#L19-L28