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 list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
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 | train |
gopasspw/gopass | pkg/action/context.go | WithForce | func WithForce(ctx context.Context, force bool) context.Context {
return context.WithValue(ctx, ctxKeyForce, force)
} | go | func WithForce(ctx context.Context, force bool) context.Context {
return context.WithValue(ctx, ctxKeyForce, force)
} | [
"func",
"WithForce",
"(",
"ctx",
"context",
".",
"Context",
",",
"force",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyForce",
",",
"force",
")",
"\n",
"}"
] | // WithForce returns a context with the value for force set | [
"WithForce",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"force",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/context.go#L31-L33 | train |
gopasspw/gopass | pkg/action/context.go | WithPasswordOnly | func WithPasswordOnly(ctx context.Context, pw bool) context.Context {
return context.WithValue(ctx, ctxKeyPasswordOnly, pw)
} | go | func WithPasswordOnly(ctx context.Context, pw bool) context.Context {
return context.WithValue(ctx, ctxKeyPasswordOnly, pw)
} | [
"func",
"WithPasswordOnly",
"(",
"ctx",
"context",
".",
"Context",
",",
"pw",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyPasswordOnly",
",",
"pw",
")",
"\n",
"}"
] | // WithPasswordOnly returns a context with the value of password only set | [
"WithPasswordOnly",
"returns",
"a",
"context",
"with",
"the",
"value",
"of",
"password",
"only",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/context.go#L45-L47 | train |
gopasspw/gopass | pkg/action/context.go | WithPrintQR | func WithPrintQR(ctx context.Context, qr bool) context.Context {
return context.WithValue(ctx, ctxKeyPrintQR, qr)
} | go | func WithPrintQR(ctx context.Context, qr bool) context.Context {
return context.WithValue(ctx, ctxKeyPrintQR, qr)
} | [
"func",
"WithPrintQR",
"(",
"ctx",
"context",
".",
"Context",
",",
"qr",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyPrintQR",
",",
"qr",
")",
"\n",
"}"
] | // WithPrintQR returns a context with the value of print QR set | [
"WithPrintQR",
"returns",
"a",
"context",
"with",
"the",
"value",
"of",
"print",
"QR",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/context.go#L59-L61 | train |
gopasspw/gopass | pkg/action/context.go | WithRevision | func WithRevision(ctx context.Context, rev string) context.Context {
return context.WithValue(ctx, ctxKeyRevision, rev)
} | go | func WithRevision(ctx context.Context, rev string) context.Context {
return context.WithValue(ctx, ctxKeyRevision, rev)
} | [
"func",
"WithRevision",
"(",
"ctx",
"context",
".",
"Context",
",",
"rev",
"string",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyRevision",
",",
"rev",
")",
"\n",
"}"
] | // WithRevision returns a context withe the value of revision set | [
"WithRevision",
"returns",
"a",
"context",
"withe",
"the",
"value",
"of",
"revision",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/context.go#L73-L75 | train |
gopasspw/gopass | pkg/action/context.go | HasRevision | func HasRevision(ctx context.Context) bool {
sv, ok := ctx.Value(ctxKeyRevision).(string)
return ok && sv != ""
} | go | func HasRevision(ctx context.Context) bool {
sv, ok := ctx.Value(ctxKeyRevision).(string)
return ok && sv != ""
} | [
"func",
"HasRevision",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"sv",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyRevision",
")",
".",
"(",
"string",
")",
"\n",
"return",
"ok",
"&&",
"sv",
"!=",
"\"",
"\"",
"\n",
"}"
] | // HasRevision returns true if a value for revision was set in this context | [
"HasRevision",
"returns",
"true",
"if",
"a",
"value",
"for",
"revision",
"was",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/context.go#L78-L81 | train |
gopasspw/gopass | pkg/action/context.go | GetRevision | func GetRevision(ctx context.Context) string {
sv, ok := ctx.Value(ctxKeyRevision).(string)
if !ok {
return ""
}
return sv
} | go | func GetRevision(ctx context.Context) string {
sv, ok := ctx.Value(ctxKeyRevision).(string)
if !ok {
return ""
}
return sv
} | [
"func",
"GetRevision",
"(",
"ctx",
"context",
".",
"Context",
")",
"string",
"{",
"sv",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyRevision",
")",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
... | // GetRevision returns the revison set in this context or an empty string | [
"GetRevision",
"returns",
"the",
"revison",
"set",
"in",
"this",
"context",
"or",
"an",
"empty",
"string"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/context.go#L84-L90 | train |
gopasspw/gopass | pkg/backend/registry.go | RegisterCrypto | func RegisterCrypto(id CryptoBackend, name string, loader CryptoLoader) {
cryptoRegistry[id] = loader
cryptoNameToBackendMap[name] = id
cryptoBackendToNameMap[id] = name
} | go | func RegisterCrypto(id CryptoBackend, name string, loader CryptoLoader) {
cryptoRegistry[id] = loader
cryptoNameToBackendMap[name] = id
cryptoBackendToNameMap[id] = name
} | [
"func",
"RegisterCrypto",
"(",
"id",
"CryptoBackend",
",",
"name",
"string",
",",
"loader",
"CryptoLoader",
")",
"{",
"cryptoRegistry",
"[",
"id",
"]",
"=",
"loader",
"\n",
"cryptoNameToBackendMap",
"[",
"name",
"]",
"=",
"id",
"\n",
"cryptoBackendToNameMap",
... | // RegisterCrypto registers a new crypto backend with the backend registry. | [
"RegisterCrypto",
"registers",
"a",
"new",
"crypto",
"backend",
"with",
"the",
"backend",
"registry",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L41-L45 | train |
gopasspw/gopass | pkg/backend/registry.go | NewCrypto | func NewCrypto(ctx context.Context, id CryptoBackend) (Crypto, error) {
if be, found := cryptoRegistry[id]; found {
return be.New(ctx)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | go | func NewCrypto(ctx context.Context, id CryptoBackend) (Crypto, error) {
if be, found := cryptoRegistry[id]; found {
return be.New(ctx)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | [
"func",
"NewCrypto",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"CryptoBackend",
")",
"(",
"Crypto",
",",
"error",
")",
"{",
"if",
"be",
",",
"found",
":=",
"cryptoRegistry",
"[",
"id",
"]",
";",
"found",
"{",
"return",
"be",
".",
"New",
"(",
... | // NewCrypto instantiates a new crypto backend. | [
"NewCrypto",
"instantiates",
"a",
"new",
"crypto",
"backend",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L48-L53 | train |
gopasspw/gopass | pkg/backend/registry.go | RegisterRCS | func RegisterRCS(id RCSBackend, name string, loader RCSLoader) {
rcsRegistry[id] = loader
rcsNameToBackendMap[name] = id
rcsBackendToNameMap[id] = name
} | go | func RegisterRCS(id RCSBackend, name string, loader RCSLoader) {
rcsRegistry[id] = loader
rcsNameToBackendMap[name] = id
rcsBackendToNameMap[id] = name
} | [
"func",
"RegisterRCS",
"(",
"id",
"RCSBackend",
",",
"name",
"string",
",",
"loader",
"RCSLoader",
")",
"{",
"rcsRegistry",
"[",
"id",
"]",
"=",
"loader",
"\n",
"rcsNameToBackendMap",
"[",
"name",
"]",
"=",
"id",
"\n",
"rcsBackendToNameMap",
"[",
"id",
"]"... | // RegisterRCS registers a new RCS backend with the backend registry. | [
"RegisterRCS",
"registers",
"a",
"new",
"RCS",
"backend",
"with",
"the",
"backend",
"registry",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L56-L60 | train |
gopasspw/gopass | pkg/backend/registry.go | OpenRCS | func OpenRCS(ctx context.Context, id RCSBackend, path string) (RCS, error) {
if be, found := rcsRegistry[id]; found {
return be.Open(ctx, path)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | go | func OpenRCS(ctx context.Context, id RCSBackend, path string) (RCS, error) {
if be, found := rcsRegistry[id]; found {
return be.Open(ctx, path)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | [
"func",
"OpenRCS",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"RCSBackend",
",",
"path",
"string",
")",
"(",
"RCS",
",",
"error",
")",
"{",
"if",
"be",
",",
"found",
":=",
"rcsRegistry",
"[",
"id",
"]",
";",
"found",
"{",
"return",
"be",
"."... | // OpenRCS opens an existing repository. | [
"OpenRCS",
"opens",
"an",
"existing",
"repository",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L63-L68 | train |
gopasspw/gopass | pkg/backend/registry.go | CloneRCS | func CloneRCS(ctx context.Context, id RCSBackend, repo, path string) (RCS, error) {
if be, found := rcsRegistry[id]; found {
out.Debug(ctx, "Cloning with %s", be.String())
return be.Clone(ctx, repo, path)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | go | func CloneRCS(ctx context.Context, id RCSBackend, repo, path string) (RCS, error) {
if be, found := rcsRegistry[id]; found {
out.Debug(ctx, "Cloning with %s", be.String())
return be.Clone(ctx, repo, path)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | [
"func",
"CloneRCS",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"RCSBackend",
",",
"repo",
",",
"path",
"string",
")",
"(",
"RCS",
",",
"error",
")",
"{",
"if",
"be",
",",
"found",
":=",
"rcsRegistry",
"[",
"id",
"]",
";",
"found",
"{",
"out"... | // CloneRCS clones an existing repository from a remote. | [
"CloneRCS",
"clones",
"an",
"existing",
"repository",
"from",
"a",
"remote",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L71-L77 | train |
gopasspw/gopass | pkg/backend/registry.go | InitRCS | func InitRCS(ctx context.Context, id RCSBackend, path, name, email string) (RCS, error) {
if be, found := rcsRegistry[id]; found {
return be.Init(ctx, path, name, email)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | go | func InitRCS(ctx context.Context, id RCSBackend, path, name, email string) (RCS, error) {
if be, found := rcsRegistry[id]; found {
return be.Init(ctx, path, name, email)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %d", id)
} | [
"func",
"InitRCS",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"RCSBackend",
",",
"path",
",",
"name",
",",
"email",
"string",
")",
"(",
"RCS",
",",
"error",
")",
"{",
"if",
"be",
",",
"found",
":=",
"rcsRegistry",
"[",
"id",
"]",
";",
"found... | // InitRCS initializes a new repository. | [
"InitRCS",
"initializes",
"a",
"new",
"repository",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L80-L85 | train |
gopasspw/gopass | pkg/backend/registry.go | RegisterStorage | func RegisterStorage(id StorageBackend, name string, loader StorageLoader) {
storageRegistry[id] = loader
storageNameToBackendMap[name] = id
storageBackendToNameMap[id] = name
} | go | func RegisterStorage(id StorageBackend, name string, loader StorageLoader) {
storageRegistry[id] = loader
storageNameToBackendMap[name] = id
storageBackendToNameMap[id] = name
} | [
"func",
"RegisterStorage",
"(",
"id",
"StorageBackend",
",",
"name",
"string",
",",
"loader",
"StorageLoader",
")",
"{",
"storageRegistry",
"[",
"id",
"]",
"=",
"loader",
"\n",
"storageNameToBackendMap",
"[",
"name",
"]",
"=",
"id",
"\n",
"storageBackendToNameMa... | // RegisterStorage registers a new storage backend with the registry. | [
"RegisterStorage",
"registers",
"a",
"new",
"storage",
"backend",
"with",
"the",
"registry",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L88-L92 | train |
gopasspw/gopass | pkg/backend/registry.go | NewStorage | func NewStorage(ctx context.Context, id StorageBackend, url *URL) (Storage, error) {
if be, found := storageRegistry[id]; found {
return be.New(ctx, url)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %s", url.String())
} | go | func NewStorage(ctx context.Context, id StorageBackend, url *URL) (Storage, error) {
if be, found := storageRegistry[id]; found {
return be.New(ctx, url)
}
return nil, errors.Wrapf(ErrNotFound, "unknown backend: %s", url.String())
} | [
"func",
"NewStorage",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"StorageBackend",
",",
"url",
"*",
"URL",
")",
"(",
"Storage",
",",
"error",
")",
"{",
"if",
"be",
",",
"found",
":=",
"storageRegistry",
"[",
"id",
"]",
";",
"found",
"{",
"retu... | // NewStorage initializes a new storage backend. | [
"NewStorage",
"initializes",
"a",
"new",
"storage",
"backend",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/registry.go#L95-L100 | train |
gopasspw/gopass | pkg/action/templates.go | TemplatesPrint | func (s *Action) TemplatesPrint(ctx context.Context, c *cli.Context) error {
tree, err := s.Store.TemplateTree(ctx)
if err != nil {
return ExitError(ctx, ExitList, err, "failed to list templates: %s", err)
}
fmt.Fprintln(stdout, tree.Format(0))
return nil
} | go | func (s *Action) TemplatesPrint(ctx context.Context, c *cli.Context) error {
tree, err := s.Store.TemplateTree(ctx)
if err != nil {
return ExitError(ctx, ExitList, err, "failed to list templates: %s", err)
}
fmt.Fprintln(stdout, tree.Format(0))
return nil
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"TemplatesPrint",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"tree",
",",
"err",
":=",
"s",
".",
"Store",
".",
"TemplateTree",
"(",
"ctx",
")",
"\n",
"if",
... | // TemplatesPrint will pretty-print a tree of templates | [
"TemplatesPrint",
"will",
"pretty",
"-",
"print",
"a",
"tree",
"of",
"templates"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/templates.go#L38-L45 | train |
gopasspw/gopass | pkg/action/templates.go | TemplatePrint | func (s *Action) TemplatePrint(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
content, err := s.Store.GetTemplate(ctx, name)
if err != nil {
return ExitError(ctx, ExitIO, err, "failed to retrieve template: %s", err)
}
fmt.Fprintln(stdout, string(content))
return nil
} | go | func (s *Action) TemplatePrint(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
content, err := s.Store.GetTemplate(ctx, name)
if err != nil {
return ExitError(ctx, ExitIO, err, "failed to retrieve template: %s", err)
}
fmt.Fprintln(stdout, string(content))
return nil
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"TemplatePrint",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"name",
":=",
"c",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"\n\n",
"content",
",",
"err"... | // TemplatePrint will lookup and print a single template | [
"TemplatePrint",
"will",
"lookup",
"and",
"print",
"a",
"single",
"template"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/templates.go#L48-L58 | train |
gopasspw/gopass | pkg/action/templates.go | TemplateEdit | func (s *Action) TemplateEdit(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
var content []byte
if s.Store.HasTemplate(ctx, name) {
var err error
content, err = s.Store.GetTemplate(ctx, name)
if err != nil {
return ExitError(ctx, ExitIO, err, "failed to retrieve template: %s", err)
... | go | func (s *Action) TemplateEdit(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
var content []byte
if s.Store.HasTemplate(ctx, name) {
var err error
content, err = s.Store.GetTemplate(ctx, name)
if err != nil {
return ExitError(ctx, ExitIO, err, "failed to retrieve template: %s", err)
... | [
"func",
"(",
"s",
"*",
"Action",
")",
"TemplateEdit",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"name",
":=",
"c",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"\n\n",
"var",
"content",
"[",... | // TemplateEdit will load and existing or new template into an
// editor | [
"TemplateEdit",
"will",
"load",
"and",
"existing",
"or",
"new",
"template",
"into",
"an",
"editor"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/templates.go#L62-L88 | train |
gopasspw/gopass | pkg/action/templates.go | TemplateRemove | func (s *Action) TemplateRemove(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
if name == "" {
return ExitError(ctx, ExitUsage, nil, "usage: %s templates remove [name]", s.Name)
}
if !s.Store.HasTemplate(ctx, name) {
return ExitError(ctx, ExitNotFound, nil, "template '%s' not found", nam... | go | func (s *Action) TemplateRemove(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
if name == "" {
return ExitError(ctx, ExitUsage, nil, "usage: %s templates remove [name]", s.Name)
}
if !s.Store.HasTemplate(ctx, name) {
return ExitError(ctx, ExitNotFound, nil, "template '%s' not found", nam... | [
"func",
"(",
"s",
"*",
"Action",
")",
"TemplateRemove",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"name",
":=",
"c",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"\n",
"if",
"name",
"==",
... | // TemplateRemove will remove a single template | [
"TemplateRemove",
"will",
"remove",
"a",
"single",
"template"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/templates.go#L91-L102 | train |
gopasspw/gopass | pkg/action/templates.go | TemplatesComplete | func (s *Action) TemplatesComplete(ctx context.Context, c *cli.Context) {
tree, err := s.Store.TemplateTree(ctx)
if err != nil {
fmt.Fprintln(stdout, err)
return
}
for _, v := range tree.List(0) {
fmt.Fprintln(stdout, v)
}
} | go | func (s *Action) TemplatesComplete(ctx context.Context, c *cli.Context) {
tree, err := s.Store.TemplateTree(ctx)
if err != nil {
fmt.Fprintln(stdout, err)
return
}
for _, v := range tree.List(0) {
fmt.Fprintln(stdout, v)
}
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"TemplatesComplete",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"{",
"tree",
",",
"err",
":=",
"s",
".",
"Store",
".",
"TemplateTree",
"(",
"ctx",
")",
"\n",
"if",
"err",
... | // TemplatesComplete prints a list of all templates for bash completion | [
"TemplatesComplete",
"prints",
"a",
"list",
"of",
"all",
"templates",
"for",
"bash",
"completion"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/templates.go#L105-L115 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/version.go | Version | func (g *GPG) Version(ctx context.Context) semver.Version {
return version(ctx, g.Binary())
} | go | func (g *GPG) Version(ctx context.Context) semver.Version {
return version(ctx, g.Binary())
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"Version",
"(",
"ctx",
"context",
".",
"Context",
")",
"semver",
".",
"Version",
"{",
"return",
"version",
"(",
"ctx",
",",
"g",
".",
"Binary",
"(",
")",
")",
"\n",
"}"
] | // Version will returns GPG version information | [
"Version",
"will",
"returns",
"GPG",
"version",
"information"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/version.go#L33-L35 | train |
gopasspw/gopass | pkg/backend/crypto/xc/xcpb/identity.go | ID | func (i Identity) ID() string {
out := i.Name
if i.Comment != "" {
out += " (" + i.Comment + ")"
}
out += " <" + i.Email + ">"
return out
} | go | func (i Identity) ID() string {
out := i.Name
if i.Comment != "" {
out += " (" + i.Comment + ")"
}
out += " <" + i.Email + ">"
return out
} | [
"func",
"(",
"i",
"Identity",
")",
"ID",
"(",
")",
"string",
"{",
"out",
":=",
"i",
".",
"Name",
"\n",
"if",
"i",
".",
"Comment",
"!=",
"\"",
"\"",
"{",
"out",
"+=",
"\"",
"\"",
"+",
"i",
".",
"Comment",
"+",
"\"",
"\"",
"\n",
"}",
"\n",
"o... | // ID returns the GPG ID format | [
"ID",
"returns",
"the",
"GPG",
"ID",
"format"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/xcpb/identity.go#L4-L11 | train |
gopasspw/gopass | pkg/store/root/write.go | Set | func (r *Store) Set(ctx context.Context, name string, sec store.Secret) error {
ctx, store, name := r.getStore(ctx, name)
return store.Set(ctx, name, sec)
} | go | func (r *Store) Set(ctx context.Context, name string, sec store.Secret) error {
ctx, store, name := r.getStore(ctx, name)
return store.Set(ctx, name, sec)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"Set",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"sec",
"store",
".",
"Secret",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"name",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name"... | // Set encodes and write the ciphertext of one entry to disk | [
"Set",
"encodes",
"and",
"write",
"the",
"ciphertext",
"of",
"one",
"entry",
"to",
"disk"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/write.go#L10-L13 | train |
gopasspw/gopass | pkg/agent/client/context.go | WithClient | func WithClient(ctx context.Context, c *Client) context.Context {
return context.WithValue(ctx, ctxKeyClient, c)
} | go | func WithClient(ctx context.Context, c *Client) context.Context {
return context.WithValue(ctx, ctxKeyClient, c)
} | [
"func",
"WithClient",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"Client",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyClient",
",",
"c",
")",
"\n",
"}"
] | // WithClient returns a context with a client instance set. | [
"WithClient",
"returns",
"a",
"context",
"with",
"a",
"client",
"instance",
"set",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/agent/client/context.go#L12-L14 | train |
gopasspw/gopass | pkg/agent/client/context.go | GetClient | func GetClient(ctx context.Context) *Client {
c, ok := ctx.Value(ctxKeyClient).(*Client)
if !ok {
return nil
}
return c
} | go | func GetClient(ctx context.Context) *Client {
c, ok := ctx.Value(ctxKeyClient).(*Client)
if !ok {
return nil
}
return c
} | [
"func",
"GetClient",
"(",
"ctx",
"context",
".",
"Context",
")",
"*",
"Client",
"{",
"c",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyClient",
")",
".",
"(",
"*",
"Client",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"nil",
"\n",
"}",
"\n",
... | // GetClient returns a client instance, if set. May be nil. | [
"GetClient",
"returns",
"a",
"client",
"instance",
"if",
"set",
".",
"May",
"be",
"nil",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/agent/client/context.go#L17-L23 | train |
gopasspw/gopass | pkg/action/update.go | Update | func (s *Action) Update(ctx context.Context, c *cli.Context) error {
pre := c.Bool("pre")
if s.version.String() == "0.0.0+HEAD" {
out.Error(ctx, "Can not check version against HEAD")
return nil
}
if err := updater.Update(ctx, pre, s.version); err != nil {
return ExitError(ctx, ExitUnknown, err, "Failed to u... | go | func (s *Action) Update(ctx context.Context, c *cli.Context) error {
pre := c.Bool("pre")
if s.version.String() == "0.0.0+HEAD" {
out.Error(ctx, "Can not check version against HEAD")
return nil
}
if err := updater.Update(ctx, pre, s.version); err != nil {
return ExitError(ctx, ExitUnknown, err, "Failed to u... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"pre",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"s",
".",
"version",
".",
"String... | // Update will start the interactive update assistant | [
"Update",
"will",
"start",
"the",
"interactive",
"update",
"assistant"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/update.go#L13-L25 | train |
gopasspw/gopass | pkg/clipboard/unclip.go | Clear | func Clear(ctx context.Context, checksum string, force bool) error {
if clipboard.Unsupported {
return ErrNotSupported
}
cur, err := clipboard.ReadAll()
if err != nil {
return errors.Wrapf(err, "failed to read clipboard: %s", err)
}
hash := fmt.Sprintf("%x", sha256.Sum256([]byte(cur)))
if hash != checksum ... | go | func Clear(ctx context.Context, checksum string, force bool) error {
if clipboard.Unsupported {
return ErrNotSupported
}
cur, err := clipboard.ReadAll()
if err != nil {
return errors.Wrapf(err, "failed to read clipboard: %s", err)
}
hash := fmt.Sprintf("%x", sha256.Sum256([]byte(cur)))
if hash != checksum ... | [
"func",
"Clear",
"(",
"ctx",
"context",
".",
"Context",
",",
"checksum",
"string",
",",
"force",
"bool",
")",
"error",
"{",
"if",
"clipboard",
".",
"Unsupported",
"{",
"return",
"ErrNotSupported",
"\n",
"}",
"\n\n",
"cur",
",",
"err",
":=",
"clipboard",
... | // Clear will attempt to erase the clipboard | [
"Clear",
"will",
"attempt",
"to",
"erase",
"the",
"clipboard"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/clipboard/unclip.go#L15-L45 | train |
gopasspw/gopass | pkg/notify/notify_darwin.go | Notify | func Notify(ctx context.Context, subj, msg string) error {
if os.Getenv("GOPASS_NO_NOTIFY") != "" || !ctxutil.IsNotifications(ctx) {
return nil
}
osas, err := exec.LookPath("osascript")
if err != nil {
return err
}
return exec.Command(
osas,
"-e",
`display notification "`+msg+`" with title "`+subj+`"`,... | go | func Notify(ctx context.Context, subj, msg string) error {
if os.Getenv("GOPASS_NO_NOTIFY") != "" || !ctxutil.IsNotifications(ctx) {
return nil
}
osas, err := exec.LookPath("osascript")
if err != nil {
return err
}
return exec.Command(
osas,
"-e",
`display notification "`+msg+`" with title "`+subj+`"`,... | [
"func",
"Notify",
"(",
"ctx",
"context",
".",
"Context",
",",
"subj",
",",
"msg",
"string",
")",
"error",
"{",
"if",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
"!=",
"\"",
"\"",
"||",
"!",
"ctxutil",
".",
"IsNotifications",
"(",
"ctx",
")",
"{",
... | // Notify displays a desktop notification using osascript | [
"Notify",
"displays",
"a",
"desktop",
"notification",
"using",
"osascript"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/notify/notify_darwin.go#L14-L28 | train |
gopasspw/gopass | pkg/action/show.go | Show | func (s *Action) Show(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
key := c.Args().Get(1)
ctx = s.Store.WithConfig(ctx, name)
ctx = WithClip(ctx, c.Bool("clip"))
ctx = WithForce(ctx, c.Bool("force"))
ctx = WithPrintQR(ctx, c.Bool("qr"))
ctx = WithPasswordOnly(ctx, c.Bool("password"))
c... | go | func (s *Action) Show(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
key := c.Args().Get(1)
ctx = s.Store.WithConfig(ctx, name)
ctx = WithClip(ctx, c.Bool("clip"))
ctx = WithForce(ctx, c.Bool("force"))
ctx = WithPrintQR(ctx, c.Bool("qr"))
ctx = WithPasswordOnly(ctx, c.Bool("password"))
c... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Show",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"name",
":=",
"c",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"\n",
"key",
":=",
"c",
".",
"Args... | // Show the content of a secret file | [
"Show",
"the",
"content",
"of",
"a",
"secret",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/show.go#L25-L46 | train |
gopasspw/gopass | pkg/action/show.go | showHandleRevision | func (s *Action) showHandleRevision(ctx context.Context, c *cli.Context, name, key, revision string) error {
sec, err := s.Store.GetRevision(ctx, name, revision)
if err != nil {
return s.showHandleError(ctx, c, name, false, err)
}
return s.showHandleOutput(ctx, name, key, sec)
} | go | func (s *Action) showHandleRevision(ctx context.Context, c *cli.Context, name, key, revision string) error {
sec, err := s.Store.GetRevision(ctx, name, revision)
if err != nil {
return s.showHandleError(ctx, c, name, false, err)
}
return s.showHandleOutput(ctx, name, key, sec)
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"showHandleRevision",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
",",
"name",
",",
"key",
",",
"revision",
"string",
")",
"error",
"{",
"sec",
",",
"err",
":=",
"s",
".",
"Stor... | // showHandleRevision displays a single revision | [
"showHandleRevision",
"displays",
"a",
"single",
"revision"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/show.go#L79-L86 | train |
gopasspw/gopass | pkg/action/show.go | showHandleOutput | func (s *Action) showHandleOutput(ctx context.Context, name, key string, sec store.Secret) error {
var content string
switch {
case key != "":
val, err := sec.Value(key)
if err != nil {
return s.showHandleYAMLError(ctx, name, key, err)
}
if IsClip(ctx) {
return clipboard.CopyTo(ctx, name, []byte(val))... | go | func (s *Action) showHandleOutput(ctx context.Context, name, key string, sec store.Secret) error {
var content string
switch {
case key != "":
val, err := sec.Value(key)
if err != nil {
return s.showHandleYAMLError(ctx, name, key, err)
}
if IsClip(ctx) {
return clipboard.CopyTo(ctx, name, []byte(val))... | [
"func",
"(",
"s",
"*",
"Action",
")",
"showHandleOutput",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"key",
"string",
",",
"sec",
"store",
".",
"Secret",
")",
"error",
"{",
"var",
"content",
"string",
"\n\n",
"switch",
"{",
"case",
"key",... | // showHandleOutput displays a secret | [
"showHandleOutput",
"displays",
"a",
"secret"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/show.go#L89-L131 | train |
gopasspw/gopass | pkg/action/show.go | showHandleError | func (s *Action) showHandleError(ctx context.Context, c *cli.Context, name string, recurse bool, err error) error {
if err != store.ErrNotFound || !recurse || !ctxutil.IsTerminal(ctx) {
return ExitError(ctx, ExitUnknown, err, "failed to retrieve secret '%s': %s", name, err)
}
out.Yellow(ctx, "Entry '%s' not found.... | go | func (s *Action) showHandleError(ctx context.Context, c *cli.Context, name string, recurse bool, err error) error {
if err != store.ErrNotFound || !recurse || !ctxutil.IsTerminal(ctx) {
return ExitError(ctx, ExitUnknown, err, "failed to retrieve secret '%s': %s", name, err)
}
out.Yellow(ctx, "Entry '%s' not found.... | [
"func",
"(",
"s",
"*",
"Action",
")",
"showHandleError",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
",",
"name",
"string",
",",
"recurse",
"bool",
",",
"err",
"error",
")",
"error",
"{",
"if",
"err",
"!=",
"store",
... | // showHandleError handles errors retrieving secrets | [
"showHandleError",
"handles",
"errors",
"retrieving",
"secrets"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/show.go#L134-L144 | train |
gopasspw/gopass | pkg/updater/update.go | Update | func Update(ctx context.Context, pre bool, version semver.Version) error {
if err := IsUpdateable(ctx); err != nil {
out.Error(ctx, "Your gopass binary is externally managed. Can not update.")
out.Debug(ctx, "Error: %s", err)
return nil
}
ok, err := termio.AskForBool(ctx, "Do you want to check for available u... | go | func Update(ctx context.Context, pre bool, version semver.Version) error {
if err := IsUpdateable(ctx); err != nil {
out.Error(ctx, "Your gopass binary is externally managed. Can not update.")
out.Debug(ctx, "Error: %s", err)
return nil
}
ok, err := termio.AskForBool(ctx, "Do you want to check for available u... | [
"func",
"Update",
"(",
"ctx",
"context",
".",
"Context",
",",
"pre",
"bool",
",",
"version",
"semver",
".",
"Version",
")",
"error",
"{",
"if",
"err",
":=",
"IsUpdateable",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"out",
".",
"Error",
"(",
"c... | // Update will start hte interactive update assistant | [
"Update",
"will",
"start",
"hte",
"interactive",
"update",
"assistant"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/updater/update.go#L41-L89 | train |
gopasspw/gopass | pkg/action/history.go | History | func (s *Action) History(ctx context.Context, c *cli.Context) error {
name := c.Args().Get(0)
showPassword := c.Bool("password")
if name == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s history <NAME>", s.Name)
}
if !s.Store.Exists(ctx, name) {
return ExitError(ctx, ExitNotFound, nil, "Secret not fou... | go | func (s *Action) History(ctx context.Context, c *cli.Context) error {
name := c.Args().Get(0)
showPassword := c.Bool("password")
if name == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s history <NAME>", s.Name)
}
if !s.Store.Exists(ctx, name) {
return ExitError(ctx, ExitNotFound, nil, "Secret not fou... | [
"func",
"(",
"s",
"*",
"Action",
")",
"History",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"name",
":=",
"c",
".",
"Args",
"(",
")",
".",
"Get",
"(",
"0",
")",
"\n",
"showPassword",
":=",
"c... | // History displays the history of a given secret | [
"History",
"displays",
"the",
"history",
"of",
"a",
"given",
"secret"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/history.go#L13-L44 | train |
gopasspw/gopass | pkg/fsutil/fsutil.go | CleanPath | func CleanPath(path string) string {
// http://stackoverflow.com/questions/17609732/expand-tilde-to-home-directory
if len(path) > 1 && path[:2] == "~/" {
usr, _ := user.Current()
dir := usr.HomeDir
path = strings.Replace(path, "~/", dir+"/", 1)
}
if p, err := filepath.Abs(path); err == nil {
return p
}
re... | go | func CleanPath(path string) string {
// http://stackoverflow.com/questions/17609732/expand-tilde-to-home-directory
if len(path) > 1 && path[:2] == "~/" {
usr, _ := user.Current()
dir := usr.HomeDir
path = strings.Replace(path, "~/", dir+"/", 1)
}
if p, err := filepath.Abs(path); err == nil {
return p
}
re... | [
"func",
"CleanPath",
"(",
"path",
"string",
")",
"string",
"{",
"// http://stackoverflow.com/questions/17609732/expand-tilde-to-home-directory",
"if",
"len",
"(",
"path",
")",
">",
"1",
"&&",
"path",
"[",
":",
"2",
"]",
"==",
"\"",
"\"",
"{",
"usr",
",",
"_",
... | // CleanPath resolves common aliases in a path and cleans it as much as possible | [
"CleanPath",
"resolves",
"common",
"aliases",
"in",
"a",
"path",
"and",
"cleans",
"it",
"as",
"much",
"as",
"possible"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/fsutil/fsutil.go#L26-L37 | train |
gopasspw/gopass | pkg/fsutil/fsutil.go | IsFile | func IsFile(path string) bool {
fi, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
// not found
return false
}
fmt.Printf("failed to check dir %s: %s\n", path, err)
return false
}
return fi.Mode().IsRegular()
} | go | func IsFile(path string) bool {
fi, err := os.Stat(path)
if err != nil {
if os.IsNotExist(err) {
// not found
return false
}
fmt.Printf("failed to check dir %s: %s\n", path, err)
return false
}
return fi.Mode().IsRegular()
} | [
"func",
"IsFile",
"(",
"path",
"string",
")",
"bool",
"{",
"fi",
",",
"err",
":=",
"os",
".",
"Stat",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"os",
".",
"IsNotExist",
"(",
"err",
")",
"{",
"// not found",
"return",
"false",
"... | // IsFile checks if a certain path is actually a file | [
"IsFile",
"checks",
"if",
"a",
"certain",
"path",
"is",
"actually",
"a",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/fsutil/fsutil.go#L56-L68 | train |
gopasspw/gopass | pkg/fsutil/fsutil.go | IsEmptyDir | func IsEmptyDir(path string) (bool, error) {
empty := true
if err := filepath.Walk(path, func(fp string, fi os.FileInfo, ferr error) error {
if ferr != nil {
return ferr
}
if fi.IsDir() && (fi.Name() == "." || fi.Name() == "..") {
return filepath.SkipDir
}
if fi.Mode().IsRegular() {
empty = false
... | go | func IsEmptyDir(path string) (bool, error) {
empty := true
if err := filepath.Walk(path, func(fp string, fi os.FileInfo, ferr error) error {
if ferr != nil {
return ferr
}
if fi.IsDir() && (fi.Name() == "." || fi.Name() == "..") {
return filepath.SkipDir
}
if fi.Mode().IsRegular() {
empty = false
... | [
"func",
"IsEmptyDir",
"(",
"path",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"empty",
":=",
"true",
"\n",
"if",
"err",
":=",
"filepath",
".",
"Walk",
"(",
"path",
",",
"func",
"(",
"fp",
"string",
",",
"fi",
"os",
".",
"FileInfo",
",",
... | // IsEmptyDir checks if a certain path is an empty directory | [
"IsEmptyDir",
"checks",
"if",
"a",
"certain",
"path",
"is",
"an",
"empty",
"directory"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/fsutil/fsutil.go#L71-L88 | train |
gopasspw/gopass | pkg/fsutil/fsutil.go | Shred | func Shred(path string, runs int) error {
rand.Seed(time.Now().UnixNano())
fh, err := os.OpenFile(path, os.O_WRONLY, 0600)
if err != nil {
return errors.Wrapf(err, "failed to open file '%s'", path)
}
buf := make([]byte, 1024)
for i := 0; i < runs; i++ {
// overwrite using pseudo-random data n-1 times and
//... | go | func Shred(path string, runs int) error {
rand.Seed(time.Now().UnixNano())
fh, err := os.OpenFile(path, os.O_WRONLY, 0600)
if err != nil {
return errors.Wrapf(err, "failed to open file '%s'", path)
}
buf := make([]byte, 1024)
for i := 0; i < runs; i++ {
// overwrite using pseudo-random data n-1 times and
//... | [
"func",
"Shred",
"(",
"path",
"string",
",",
"runs",
"int",
")",
"error",
"{",
"rand",
".",
"Seed",
"(",
"time",
".",
"Now",
"(",
")",
".",
"UnixNano",
"(",
")",
")",
"\n",
"fh",
",",
"err",
":=",
"os",
".",
"OpenFile",
"(",
"path",
",",
"os",
... | // Shred overwrite the given file any number of times | [
"Shred",
"overwrite",
"the",
"given",
"file",
"any",
"number",
"of",
"times"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/fsutil/fsutil.go#L91-L125 | train |
gopasspw/gopass | pkg/action/copy.go | Copy | func (s *Action) Copy(ctx context.Context, c *cli.Context) error {
force := c.Bool("force")
if len(c.Args()) != 2 {
return ExitError(ctx, ExitUsage, nil, "Usage: %s cp <FROM> <TO>", s.Name)
}
from := c.Args()[0]
to := c.Args()[1]
return s.copy(ctx, from, to, force)
} | go | func (s *Action) Copy(ctx context.Context, c *cli.Context) error {
force := c.Bool("force")
if len(c.Args()) != 2 {
return ExitError(ctx, ExitUsage, nil, "Usage: %s cp <FROM> <TO>", s.Name)
}
from := c.Args()[0]
to := c.Args()[1]
return s.copy(ctx, from, to, force)
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"Copy",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"force",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n\n",
"if",
"len",
"(",
"c",
".",
"Args",
"... | // Copy the contents of a file to another one | [
"Copy",
"the",
"contents",
"of",
"a",
"file",
"to",
"another",
"one"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/copy.go#L13-L24 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | GetTemplate | func (s *Store) GetTemplate(context.Context, string) ([]byte, error) {
return nil, fmt.Errorf("not supported")
} | go | func (s *Store) GetTemplate(context.Context, string) ([]byte, error) {
return nil, fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"GetTemplate",
"(",
"context",
".",
"Context",
",",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // GetTemplate is unsupported | [
"GetTemplate",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L16-L18 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | LookupTemplate | func (s *Store) LookupTemplate(context.Context, string) (string, []byte, bool) {
return "", nil, false
} | go | func (s *Store) LookupTemplate(context.Context, string) (string, []byte, bool) {
return "", nil, false
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"LookupTemplate",
"(",
"context",
".",
"Context",
",",
"string",
")",
"(",
"string",
",",
"[",
"]",
"byte",
",",
"bool",
")",
"{",
"return",
"\"",
"\"",
",",
"nil",
",",
"false",
"\n",
"}"
] | // LookupTemplate is unsupported | [
"LookupTemplate",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L31-L33 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | SetTemplate | func (s *Store) SetTemplate(context.Context, string, []byte) error {
return fmt.Errorf("not supported")
} | go | func (s *Store) SetTemplate(context.Context, string, []byte) error {
return fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"SetTemplate",
"(",
"context",
".",
"Context",
",",
"string",
",",
"[",
"]",
"byte",
")",
"error",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // SetTemplate is unsupported | [
"SetTemplate",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L41-L43 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | TemplateTree | func (s *Store) TemplateTree(context.Context) (tree.Tree, error) {
return nil, fmt.Errorf("not supported")
} | go | func (s *Store) TemplateTree(context.Context) (tree.Tree, error) {
return nil, fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"TemplateTree",
"(",
"context",
".",
"Context",
")",
"(",
"tree",
".",
"Tree",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // TemplateTree is unsupported | [
"TemplateTree",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L46-L48 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | GetRecipients | func (s *Store) GetRecipients(context.Context, string) ([]string, error) {
return nil, fmt.Errorf("not supported")
} | go | func (s *Store) GetRecipients(context.Context, string) ([]string, error) {
return nil, fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"GetRecipients",
"(",
"context",
".",
"Context",
",",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // GetRecipients is unsupported | [
"GetRecipients",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L56-L58 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | ExportMissingPublicKeys | func (s *Store) ExportMissingPublicKeys(context.Context, []string) (bool, error) {
return false, fmt.Errorf("not supported")
} | go | func (s *Store) ExportMissingPublicKeys(context.Context, []string) (bool, error) {
return false, fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"ExportMissingPublicKeys",
"(",
"context",
".",
"Context",
",",
"[",
"]",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"return",
"false",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // ExportMissingPublicKeys is unsupported | [
"ExportMissingPublicKeys",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L86-L88 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | GitInit | func (s *Store) GitInit(context.Context, string, string) error {
return fmt.Errorf("not supported")
} | go | func (s *Store) GitInit(context.Context, string, string) error {
return fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"GitInit",
"(",
"context",
".",
"Context",
",",
"string",
",",
"string",
")",
"error",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // GitInit is unsupported | [
"GitInit",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L106-L108 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | GetRevision | func (s *Store) GetRevision(context.Context, string, string) (store.Secret, error) {
return nil, fmt.Errorf("not supported")
} | go | func (s *Store) GetRevision(context.Context, string, string) (store.Secret, error) {
return nil, fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"GetRevision",
"(",
"context",
".",
"Context",
",",
"string",
",",
"string",
")",
"(",
"store",
".",
"Secret",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}... | // GetRevision is unsupported | [
"GetRevision",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L111-L113 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | ListRevisions | func (s *Store) ListRevisions(context.Context, string) ([]backend.Revision, error) {
return nil, fmt.Errorf("not supported")
} | go | func (s *Store) ListRevisions(context.Context, string) ([]backend.Revision, error) {
return nil, fmt.Errorf("not supported")
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"ListRevisions",
"(",
"context",
".",
"Context",
",",
"string",
")",
"(",
"[",
"]",
"backend",
".",
"Revision",
",",
"error",
")",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"... | // ListRevisions is unsupported | [
"ListRevisions",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L116-L118 | train |
gopasspw/gopass | pkg/store/vault/unsupported.go | Fsck | func (s *Store) Fsck(ctx context.Context, prefix string) error {
return nil
} | go | func (s *Store) Fsck(ctx context.Context, prefix string) error {
return nil
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"Fsck",
"(",
"ctx",
"context",
".",
"Context",
",",
"prefix",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Fsck is unsupported | [
"Fsck",
"is",
"unsupported"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/vault/unsupported.go#L121-L123 | train |
gopasspw/gopass | pkg/pwgen/pwgen.go | GeneratePassword | func GeneratePassword(length int, symbols bool) string {
chars := digits + upper + lower
if symbols {
chars += syms
}
if c := os.Getenv("GOPASS_CHARACTER_SET"); c != "" {
chars = c
}
if c := os.Getenv("GOPASS_EXTERNAL_PWGEN"); c != "" {
if pw, err := generateExternal(c); err == nil {
return pw
}
}
re... | go | func GeneratePassword(length int, symbols bool) string {
chars := digits + upper + lower
if symbols {
chars += syms
}
if c := os.Getenv("GOPASS_CHARACTER_SET"); c != "" {
chars = c
}
if c := os.Getenv("GOPASS_EXTERNAL_PWGEN"); c != "" {
if pw, err := generateExternal(c); err == nil {
return pw
}
}
re... | [
"func",
"GeneratePassword",
"(",
"length",
"int",
",",
"symbols",
"bool",
")",
"string",
"{",
"chars",
":=",
"digits",
"+",
"upper",
"+",
"lower",
"\n",
"if",
"symbols",
"{",
"chars",
"+=",
"syms",
"\n",
"}",
"\n",
"if",
"c",
":=",
"os",
".",
"Getenv... | // GeneratePassword generates a random, hard to remember password | [
"GeneratePassword",
"generates",
"a",
"random",
"hard",
"to",
"remember",
"password"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pwgen/pwgen.go#L36-L50 | train |
gopasspw/gopass | pkg/pwgen/pwgen.go | GeneratePasswordCharset | func GeneratePasswordCharset(length int, chars string) string {
pw := &bytes.Buffer{}
for pw.Len() < length {
_ = pw.WriteByte(chars[randomInteger(len(chars))])
}
return pw.String()
} | go | func GeneratePasswordCharset(length int, chars string) string {
pw := &bytes.Buffer{}
for pw.Len() < length {
_ = pw.WriteByte(chars[randomInteger(len(chars))])
}
return pw.String()
} | [
"func",
"GeneratePasswordCharset",
"(",
"length",
"int",
",",
"chars",
"string",
")",
"string",
"{",
"pw",
":=",
"&",
"bytes",
".",
"Buffer",
"{",
"}",
"\n",
"for",
"pw",
".",
"Len",
"(",
")",
"<",
"length",
"{",
"_",
"=",
"pw",
".",
"WriteByte",
"... | // GeneratePasswordCharset generates a random password from a given
// set of characters | [
"GeneratePasswordCharset",
"generates",
"a",
"random",
"password",
"from",
"a",
"given",
"set",
"of",
"characters"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pwgen/pwgen.go#L74-L80 | train |
gopasspw/gopass | pkg/pwgen/pwgen.go | GeneratePasswordCharsetCheck | func GeneratePasswordCharsetCheck(length int, chars string) string {
validator := crunchy.NewValidator()
var password string
for i := 0; i < 3; i++ {
pw := &bytes.Buffer{}
for pw.Len() < length {
_ = pw.WriteByte(chars[randomInteger(len(chars))])
}
password = pw.String()
if validator.Check(password) =... | go | func GeneratePasswordCharsetCheck(length int, chars string) string {
validator := crunchy.NewValidator()
var password string
for i := 0; i < 3; i++ {
pw := &bytes.Buffer{}
for pw.Len() < length {
_ = pw.WriteByte(chars[randomInteger(len(chars))])
}
password = pw.String()
if validator.Check(password) =... | [
"func",
"GeneratePasswordCharsetCheck",
"(",
"length",
"int",
",",
"chars",
"string",
")",
"string",
"{",
"validator",
":=",
"crunchy",
".",
"NewValidator",
"(",
")",
"\n",
"var",
"password",
"string",
"\n\n",
"for",
"i",
":=",
"0",
";",
"i",
"<",
"3",
"... | // GeneratePasswordCharsetCheck generates a random password from a given
// set of characters and validates the generated password with crunchy | [
"GeneratePasswordCharsetCheck",
"generates",
"a",
"random",
"password",
"from",
"a",
"given",
"set",
"of",
"characters",
"and",
"validates",
"the",
"generated",
"password",
"with",
"crunchy"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pwgen/pwgen.go#L112-L129 | train |
gopasspw/gopass | pkg/backend/crypto/xc/export.go | ExportPublicKey | func (x *XC) ExportPublicKey(ctx context.Context, id string) ([]byte, error) {
if x.pubring.Contains(id) {
return x.pubring.Export(id)
}
if x.secring.Contains(id) {
return x.secring.Export(id, false)
}
return nil, fmt.Errorf("key not found")
} | go | func (x *XC) ExportPublicKey(ctx context.Context, id string) ([]byte, error) {
if x.pubring.Contains(id) {
return x.pubring.Export(id)
}
if x.secring.Contains(id) {
return x.secring.Export(id, false)
}
return nil, fmt.Errorf("key not found")
} | [
"func",
"(",
"x",
"*",
"XC",
")",
"ExportPublicKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"x",
".",
"pubring",
".",
"Contains",
"(",
"id",
")",
"{",
"return",
"x",
... | // ExportPublicKey exports a given public key | [
"ExportPublicKey",
"exports",
"a",
"given",
"public",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/export.go#L9-L17 | train |
gopasspw/gopass | pkg/backend/crypto/xc/export.go | ExportPrivateKey | func (x *XC) ExportPrivateKey(ctx context.Context, id string) ([]byte, error) {
return x.secring.Export(id, true)
} | go | func (x *XC) ExportPrivateKey(ctx context.Context, id string) ([]byte, error) {
return x.secring.Export(id, true)
} | [
"func",
"(",
"x",
"*",
"XC",
")",
"ExportPrivateKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"return",
"x",
".",
"secring",
".",
"Export",
"(",
"id",
",",
"true",
")",
"\n",... | // ExportPrivateKey exports a given private key | [
"ExportPrivateKey",
"exports",
"a",
"given",
"private",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/export.go#L20-L22 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithDebug | func WithDebug(ctx context.Context, dbg bool) context.Context {
return context.WithValue(ctx, ctxKeyDebug, dbg)
} | go | func WithDebug(ctx context.Context, dbg bool) context.Context {
return context.WithValue(ctx, ctxKeyDebug, dbg)
} | [
"func",
"WithDebug",
"(",
"ctx",
"context",
".",
"Context",
",",
"dbg",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyDebug",
",",
"dbg",
")",
"\n",
"}"
] | // WithDebug returns a context with an explicit value for debug | [
"WithDebug",
"returns",
"a",
"context",
"with",
"an",
"explicit",
"value",
"for",
"debug"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L39-L41 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasDebug | func HasDebug(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyDebug).(bool)
return ok
} | go | func HasDebug(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyDebug).(bool)
return ok
} | [
"func",
"HasDebug",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyDebug",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasDebug returns true if a value for debug has been set in this context | [
"HasDebug",
"returns",
"true",
"if",
"a",
"value",
"for",
"debug",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L44-L47 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithColor | func WithColor(ctx context.Context, color bool) context.Context {
return context.WithValue(ctx, ctxKeyColor, color)
} | go | func WithColor(ctx context.Context, color bool) context.Context {
return context.WithValue(ctx, ctxKeyColor, color)
} | [
"func",
"WithColor",
"(",
"ctx",
"context",
".",
"Context",
",",
"color",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyColor",
",",
"color",
")",
"\n",
"}"
] | // WithColor returns a context with an explicit value for color | [
"WithColor",
"returns",
"a",
"context",
"with",
"an",
"explicit",
"value",
"for",
"color"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L59-L61 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasColor | func HasColor(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyColor).(bool)
return ok
} | go | func HasColor(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyColor).(bool)
return ok
} | [
"func",
"HasColor",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyColor",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasColor returns true if a value for Color has been set in this context | [
"HasColor",
"returns",
"true",
"if",
"a",
"value",
"for",
"Color",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L64-L67 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithTerminal | func WithTerminal(ctx context.Context, isTerm bool) context.Context {
return context.WithValue(ctx, ctxKeyTerminal, isTerm)
} | go | func WithTerminal(ctx context.Context, isTerm bool) context.Context {
return context.WithValue(ctx, ctxKeyTerminal, isTerm)
} | [
"func",
"WithTerminal",
"(",
"ctx",
"context",
".",
"Context",
",",
"isTerm",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyTerminal",
",",
"isTerm",
")",
"\n",
"}"
] | // WithTerminal returns a context with an explicit value for terminal | [
"WithTerminal",
"returns",
"a",
"context",
"with",
"an",
"explicit",
"value",
"for",
"terminal"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L79-L81 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasTerminal | func HasTerminal(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyTerminal).(bool)
return ok
} | go | func HasTerminal(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyTerminal).(bool)
return ok
} | [
"func",
"HasTerminal",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyTerminal",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasTerminal returns true if a value for Terminal has been set in this context | [
"HasTerminal",
"returns",
"true",
"if",
"a",
"value",
"for",
"Terminal",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L84-L87 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithInteractive | func WithInteractive(ctx context.Context, isInteractive bool) context.Context {
return context.WithValue(ctx, ctxKeyInteractive, isInteractive)
} | go | func WithInteractive(ctx context.Context, isInteractive bool) context.Context {
return context.WithValue(ctx, ctxKeyInteractive, isInteractive)
} | [
"func",
"WithInteractive",
"(",
"ctx",
"context",
".",
"Context",
",",
"isInteractive",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyInteractive",
",",
"isInteractive",
")",
"\n",
"}"
] | // WithInteractive returns a context with an explicit value for interactive | [
"WithInteractive",
"returns",
"a",
"context",
"with",
"an",
"explicit",
"value",
"for",
"interactive"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L99-L101 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasInteractive | func HasInteractive(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyInteractive).(bool)
return ok
} | go | func HasInteractive(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyInteractive).(bool)
return ok
} | [
"func",
"HasInteractive",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyInteractive",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasInteractive returns true if a value for Interactive has been set in this context | [
"HasInteractive",
"returns",
"true",
"if",
"a",
"value",
"for",
"Interactive",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L104-L107 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasStdin | func HasStdin(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyStdin).(bool)
return ok
} | go | func HasStdin(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyStdin).(bool)
return ok
} | [
"func",
"HasStdin",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyStdin",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasStdin returns true if a value for Stdin has been set in this context | [
"HasStdin",
"returns",
"true",
"if",
"a",
"value",
"for",
"Stdin",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L125-L128 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithAskForMore | func WithAskForMore(ctx context.Context, afm bool) context.Context {
return context.WithValue(ctx, ctxKeyAskForMore, afm)
} | go | func WithAskForMore(ctx context.Context, afm bool) context.Context {
return context.WithValue(ctx, ctxKeyAskForMore, afm)
} | [
"func",
"WithAskForMore",
"(",
"ctx",
"context",
".",
"Context",
",",
"afm",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyAskForMore",
",",
"afm",
")",
"\n",
"}"
] | // WithAskForMore returns a context with the value for ask for more set | [
"WithAskForMore",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"ask",
"for",
"more",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L141-L143 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasAskForMore | func HasAskForMore(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyAskForMore).(bool)
return ok
} | go | func HasAskForMore(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyAskForMore).(bool)
return ok
} | [
"func",
"HasAskForMore",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyAskForMore",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasAskForMore returns true if a value for AskForMore has been set in this context | [
"HasAskForMore",
"returns",
"true",
"if",
"a",
"value",
"for",
"AskForMore",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L146-L149 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithClipTimeout | func WithClipTimeout(ctx context.Context, to int) context.Context {
return context.WithValue(ctx, ctxKeyClipTimeout, to)
} | go | func WithClipTimeout(ctx context.Context, to int) context.Context {
return context.WithValue(ctx, ctxKeyClipTimeout, to)
} | [
"func",
"WithClipTimeout",
"(",
"ctx",
"context",
".",
"Context",
",",
"to",
"int",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyClipTimeout",
",",
"to",
")",
"\n",
"}"
] | // WithClipTimeout returns a context with the value for clip timeout set | [
"WithClipTimeout",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"clip",
"timeout",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L161-L163 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasClipTimeout | func HasClipTimeout(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyClipTimeout).(int)
return ok
} | go | func HasClipTimeout(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyClipTimeout).(int)
return ok
} | [
"func",
"HasClipTimeout",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyClipTimeout",
")",
".",
"(",
"int",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasClipTimeout returns true if a value for ClipTimeout has been set in this context | [
"HasClipTimeout",
"returns",
"true",
"if",
"a",
"value",
"for",
"ClipTimeout",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L166-L169 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithNoConfirm | func WithNoConfirm(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyNoConfirm, bv)
} | go | func WithNoConfirm(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyNoConfirm, bv)
} | [
"func",
"WithNoConfirm",
"(",
"ctx",
"context",
".",
"Context",
",",
"bv",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyNoConfirm",
",",
"bv",
")",
"\n",
"}"
] | // WithNoConfirm returns a context with the value for ask for more set | [
"WithNoConfirm",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"ask",
"for",
"more",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L181-L183 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasNoConfirm | func HasNoConfirm(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyNoConfirm).(bool)
return ok
} | go | func HasNoConfirm(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyNoConfirm).(bool)
return ok
} | [
"func",
"HasNoConfirm",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyNoConfirm",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasNoConfirm returns true if a value for NoConfirm has been set in this context | [
"HasNoConfirm",
"returns",
"true",
"if",
"a",
"value",
"for",
"NoConfirm",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L186-L189 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithNoPager | func WithNoPager(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyNoPager, bv)
} | go | func WithNoPager(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyNoPager, bv)
} | [
"func",
"WithNoPager",
"(",
"ctx",
"context",
".",
"Context",
",",
"bv",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyNoPager",
",",
"bv",
")",
"\n",
"}"
] | // WithNoPager returns a context with the value for ask for more set | [
"WithNoPager",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"ask",
"for",
"more",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L201-L203 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasNoPager | func HasNoPager(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyNoPager).(bool)
return ok
} | go | func HasNoPager(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyNoPager).(bool)
return ok
} | [
"func",
"HasNoPager",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyNoPager",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasNoPager returns true if a value for NoPager has been set in this context | [
"HasNoPager",
"returns",
"true",
"if",
"a",
"value",
"for",
"NoPager",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L206-L209 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithShowSafeContent | func WithShowSafeContent(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyShowSafeContent, bv)
} | go | func WithShowSafeContent(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyShowSafeContent, bv)
} | [
"func",
"WithShowSafeContent",
"(",
"ctx",
"context",
".",
"Context",
",",
"bv",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyShowSafeContent",
",",
"bv",
")",
"\n",
"}"
] | // WithShowSafeContent returns a context with the value for ShowSafeContent set | [
"WithShowSafeContent",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"ShowSafeContent",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L221-L223 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasShowSafeContent | func HasShowSafeContent(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyShowSafeContent).(bool)
return ok
} | go | func HasShowSafeContent(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyShowSafeContent).(bool)
return ok
} | [
"func",
"HasShowSafeContent",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyShowSafeContent",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasShowSafeContent returns true if a value for ShowSafeContent has been set in this context | [
"HasShowSafeContent",
"returns",
"true",
"if",
"a",
"value",
"for",
"ShowSafeContent",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L226-L229 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithGitCommit | func WithGitCommit(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyGitCommit, bv)
} | go | func WithGitCommit(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyGitCommit, bv)
} | [
"func",
"WithGitCommit",
"(",
"ctx",
"context",
".",
"Context",
",",
"bv",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyGitCommit",
",",
"bv",
")",
"\n",
"}"
] | // WithGitCommit returns a context with the value of git commit set | [
"WithGitCommit",
"returns",
"a",
"context",
"with",
"the",
"value",
"of",
"git",
"commit",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L241-L243 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasGitCommit | func HasGitCommit(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyGitCommit).(bool)
return ok
} | go | func HasGitCommit(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyGitCommit).(bool)
return ok
} | [
"func",
"HasGitCommit",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyGitCommit",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasGitCommit returns true if a value for GitCommit has been set in this context | [
"HasGitCommit",
"returns",
"true",
"if",
"a",
"value",
"for",
"GitCommit",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L246-L249 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | WithUseSymbols | func WithUseSymbols(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyUseSymbols, bv)
} | go | func WithUseSymbols(ctx context.Context, bv bool) context.Context {
return context.WithValue(ctx, ctxKeyUseSymbols, bv)
} | [
"func",
"WithUseSymbols",
"(",
"ctx",
"context",
".",
"Context",
",",
"bv",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyUseSymbols",
",",
"bv",
")",
"\n",
"}"
] | // WithUseSymbols returns a context with the value for ask for more set | [
"WithUseSymbols",
"returns",
"a",
"context",
"with",
"the",
"value",
"for",
"ask",
"for",
"more",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L261-L263 | train |
gopasspw/gopass | pkg/ctxutil/ctxutil.go | HasUseSymbols | func HasUseSymbols(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyUseSymbols).(bool)
return ok
} | go | func HasUseSymbols(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyUseSymbols).(bool)
return ok
} | [
"func",
"HasUseSymbols",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyUseSymbols",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasUseSymbols returns true if a value for UseSymbols has been set in this context | [
"HasUseSymbols",
"returns",
"true",
"if",
"a",
"value",
"for",
"UseSymbols",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/ctxutil/ctxutil.go#L266-L269 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.