id int32 0 167k | repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens listlengths 21 1.41k | docstring stringlengths 6 2.61k | docstring_tokens listlengths 3 215 | sha stringlengths 40 40 | url stringlengths 85 252 |
|---|---|---|---|---|---|---|---|---|---|---|---|
28,700 | gopasspw/gopass | pkg/backend/crypto/xc/utils.go | CreatePrivateKeyBatch | func (x *XC) CreatePrivateKeyBatch(ctx context.Context, name, email, passphrase string) error {
k, err := keyring.GenerateKeypair(passphrase)
if err != nil {
return errors.Wrapf(err, "failed to generate keypair: %s", err)
}
k.Identity.Name = name
k.Identity.Email = email
if err := x.secring.Set(k); err != nil {... | go | func (x *XC) CreatePrivateKeyBatch(ctx context.Context, name, email, passphrase string) error {
k, err := keyring.GenerateKeypair(passphrase)
if err != nil {
return errors.Wrapf(err, "failed to generate keypair: %s", err)
}
k.Identity.Name = name
k.Identity.Email = email
if err := x.secring.Set(k); err != nil {... | [
"func",
"(",
"x",
"*",
"XC",
")",
"CreatePrivateKeyBatch",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"email",
",",
"passphrase",
"string",
")",
"error",
"{",
"k",
",",
"err",
":=",
"keyring",
".",
"GenerateKeypair",
"(",
"passphrase",
")",... | // CreatePrivateKeyBatch creates a new keypair | [
"CreatePrivateKeyBatch",
"creates",
"a",
"new",
"keypair"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/utils.go#L121-L132 |
28,701 | gopasspw/gopass | pkg/backend/crypto/gpg/context.go | WithAlwaysTrust | func WithAlwaysTrust(ctx context.Context, at bool) context.Context {
return context.WithValue(ctx, ctxKeyAlwaysTrust, at)
} | go | func WithAlwaysTrust(ctx context.Context, at bool) context.Context {
return context.WithValue(ctx, ctxKeyAlwaysTrust, at)
} | [
"func",
"WithAlwaysTrust",
"(",
"ctx",
"context",
".",
"Context",
",",
"at",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyAlwaysTrust",
",",
"at",
")",
"\n",
"}"
] | // WithAlwaysTrust will return a context with the flag for always trust set | [
"WithAlwaysTrust",
"will",
"return",
"a",
"context",
"with",
"the",
"flag",
"for",
"always",
"trust",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/context.go#L12-L14 |
28,702 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | NewPubring | func NewPubring(sec *Secring) *Pubring {
return &Pubring{
data: &xcpb.Pubring{
PublicKeys: make([]*xcpb.PublicKey, 0, 10),
},
secring: sec,
}
} | go | func NewPubring(sec *Secring) *Pubring {
return &Pubring{
data: &xcpb.Pubring{
PublicKeys: make([]*xcpb.PublicKey, 0, 10),
},
secring: sec,
}
} | [
"func",
"NewPubring",
"(",
"sec",
"*",
"Secring",
")",
"*",
"Pubring",
"{",
"return",
"&",
"Pubring",
"{",
"data",
":",
"&",
"xcpb",
".",
"Pubring",
"{",
"PublicKeys",
":",
"make",
"(",
"[",
"]",
"*",
"xcpb",
".",
"PublicKey",
",",
"0",
",",
"10",
... | // NewPubring initializes a new public key ring | [
"NewPubring",
"initializes",
"a",
"new",
"public",
"key",
"ring"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L27-L34 |
28,703 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | LoadPubring | func LoadPubring(file string, sec *Secring) (*Pubring, error) {
pr := NewPubring(sec)
pr.File = file
buf, err := ioutil.ReadFile(file)
if os.IsNotExist(err) {
return pr, nil
}
if err != nil {
return nil, err
}
if err := proto.Unmarshal(buf, pr.data); err != nil {
return nil, err
}
return pr, nil
} | go | func LoadPubring(file string, sec *Secring) (*Pubring, error) {
pr := NewPubring(sec)
pr.File = file
buf, err := ioutil.ReadFile(file)
if os.IsNotExist(err) {
return pr, nil
}
if err != nil {
return nil, err
}
if err := proto.Unmarshal(buf, pr.data); err != nil {
return nil, err
}
return pr, nil
} | [
"func",
"LoadPubring",
"(",
"file",
"string",
",",
"sec",
"*",
"Secring",
")",
"(",
"*",
"Pubring",
",",
"error",
")",
"{",
"pr",
":=",
"NewPubring",
"(",
"sec",
")",
"\n",
"pr",
".",
"File",
"=",
"file",
"\n\n",
"buf",
",",
"err",
":=",
"ioutil",
... | // LoadPubring loads an existing keyring from disk. If the file is not
// found an empty keyring is returned. | [
"LoadPubring",
"loads",
"an",
"existing",
"keyring",
"from",
"disk",
".",
"If",
"the",
"file",
"is",
"not",
"found",
"an",
"empty",
"keyring",
"is",
"returned",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L38-L55 |
28,704 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | Contains | func (p *Pubring) Contains(fp string) bool {
p.Lock()
defer p.Unlock()
for _, pk := range p.data.PublicKeys {
if pk.Fingerprint == fp {
return true
}
}
if p.secring == nil {
return false
}
return p.secring.Contains(fp)
} | go | func (p *Pubring) Contains(fp string) bool {
p.Lock()
defer p.Unlock()
for _, pk := range p.data.PublicKeys {
if pk.Fingerprint == fp {
return true
}
}
if p.secring == nil {
return false
}
return p.secring.Contains(fp)
} | [
"func",
"(",
"p",
"*",
"Pubring",
")",
"Contains",
"(",
"fp",
"string",
")",
"bool",
"{",
"p",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"Unlock",
"(",
")",
"\n\n",
"for",
"_",
",",
"pk",
":=",
"range",
"p",
".",
"data",
".",
"PublicKeys"... | // Contains checks if a given key is in the keyring | [
"Contains",
"checks",
"if",
"a",
"given",
"key",
"is",
"in",
"the",
"keyring"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L67-L82 |
28,705 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | KeyIDs | func (p *Pubring) KeyIDs() []string {
p.Lock()
defer p.Unlock()
ids := make([]string, 0, len(p.data.PublicKeys))
for _, pk := range p.data.PublicKeys {
ids = append(ids, pk.Fingerprint)
}
if p.secring != nil {
ids = append(ids, p.secring.KeyIDs()...)
}
sort.Strings(ids)
return ids
} | go | func (p *Pubring) KeyIDs() []string {
p.Lock()
defer p.Unlock()
ids := make([]string, 0, len(p.data.PublicKeys))
for _, pk := range p.data.PublicKeys {
ids = append(ids, pk.Fingerprint)
}
if p.secring != nil {
ids = append(ids, p.secring.KeyIDs()...)
}
sort.Strings(ids)
return ids
} | [
"func",
"(",
"p",
"*",
"Pubring",
")",
"KeyIDs",
"(",
")",
"[",
"]",
"string",
"{",
"p",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"Unlock",
"(",
")",
"\n\n",
"ids",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"p... | // KeyIDs returns a list of all key IDs | [
"KeyIDs",
"returns",
"a",
"list",
"of",
"all",
"key",
"IDs"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L85-L98 |
28,706 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | Export | func (p *Pubring) Export(id string) ([]byte, error) {
p.Lock()
defer p.Unlock()
xpk := p.fetch(id)
if xpk == nil {
if p.secring != nil {
return p.secring.Export(id, false)
}
return nil, fmt.Errorf("key not found")
}
return proto.Marshal(xpk)
} | go | func (p *Pubring) Export(id string) ([]byte, error) {
p.Lock()
defer p.Unlock()
xpk := p.fetch(id)
if xpk == nil {
if p.secring != nil {
return p.secring.Export(id, false)
}
return nil, fmt.Errorf("key not found")
}
return proto.Marshal(xpk)
} | [
"func",
"(",
"p",
"*",
"Pubring",
")",
"Export",
"(",
"id",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"p",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"Unlock",
"(",
")",
"\n\n",
"xpk",
":=",
"p",
".",
"fetch",
"(",
... | // Export marshals a single key | [
"Export",
"marshals",
"a",
"single",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L101-L114 |
28,707 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | Import | func (p *Pubring) Import(buf []byte) error {
pk := &xcpb.PublicKey{}
if err := proto.Unmarshal(buf, pk); err != nil {
return err
}
p.insert(pk)
return nil
} | go | func (p *Pubring) Import(buf []byte) error {
pk := &xcpb.PublicKey{}
if err := proto.Unmarshal(buf, pk); err != nil {
return err
}
p.insert(pk)
return nil
} | [
"func",
"(",
"p",
"*",
"Pubring",
")",
"Import",
"(",
"buf",
"[",
"]",
"byte",
")",
"error",
"{",
"pk",
":=",
"&",
"xcpb",
".",
"PublicKey",
"{",
"}",
"\n",
"if",
"err",
":=",
"proto",
".",
"Unmarshal",
"(",
"buf",
",",
"pk",
")",
";",
"err",
... | // Import unmarshals and inserts and previously exported key | [
"Import",
"unmarshals",
"and",
"inserts",
"and",
"previously",
"exported",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L144-L152 |
28,708 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | Set | func (p *Pubring) Set(pk *PublicKey) error {
p.Lock()
defer p.Unlock()
p.insert(pubKRToPB(pk))
return nil
} | go | func (p *Pubring) Set(pk *PublicKey) error {
p.Lock()
defer p.Unlock()
p.insert(pubKRToPB(pk))
return nil
} | [
"func",
"(",
"p",
"*",
"Pubring",
")",
"Set",
"(",
"pk",
"*",
"PublicKey",
")",
"error",
"{",
"p",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"Unlock",
"(",
")",
"\n\n",
"p",
".",
"insert",
"(",
"pubKRToPB",
"(",
"pk",
")",
")",
"\n",
"r... | // Set inserts a key, possibly overwriting and existing entry | [
"Set",
"inserts",
"a",
"key",
"possibly",
"overwriting",
"and",
"existing",
"entry"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L155-L161 |
28,709 | gopasspw/gopass | pkg/backend/crypto/xc/keyring/pubring.go | Remove | func (p *Pubring) Remove(id string) error {
p.Lock()
defer p.Unlock()
match := -1
for i, pk := range p.data.PublicKeys {
if pk.Fingerprint == id {
match = i
break
}
}
if match < 0 || match > len(p.data.PublicKeys) {
return fmt.Errorf("not found")
}
p.data.PublicKeys = append(p.data.PublicKeys[:matc... | go | func (p *Pubring) Remove(id string) error {
p.Lock()
defer p.Unlock()
match := -1
for i, pk := range p.data.PublicKeys {
if pk.Fingerprint == id {
match = i
break
}
}
if match < 0 || match > len(p.data.PublicKeys) {
return fmt.Errorf("not found")
}
p.data.PublicKeys = append(p.data.PublicKeys[:matc... | [
"func",
"(",
"p",
"*",
"Pubring",
")",
"Remove",
"(",
"id",
"string",
")",
"error",
"{",
"p",
".",
"Lock",
"(",
")",
"\n",
"defer",
"p",
".",
"Unlock",
"(",
")",
"\n\n",
"match",
":=",
"-",
"1",
"\n",
"for",
"i",
",",
"pk",
":=",
"range",
"p"... | // Remove deletes a single key | [
"Remove",
"deletes",
"a",
"single",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/keyring/pubring.go#L175-L191 |
28,710 | gopasspw/gopass | pkg/config/store_config.go | ConfigMap | func (c *StoreConfig) ConfigMap() map[string]string {
m := make(map[string]string, 20)
o := reflect.ValueOf(c).Elem()
for i := 0; i < o.NumField(); i++ {
jsonArg := o.Type().Field(i).Tag.Get("yaml")
if jsonArg == "" || jsonArg == "-" {
continue
}
f := o.Field(i)
var strVal string
switch f.Kind() {
c... | go | func (c *StoreConfig) ConfigMap() map[string]string {
m := make(map[string]string, 20)
o := reflect.ValueOf(c).Elem()
for i := 0; i < o.NumField(); i++ {
jsonArg := o.Type().Field(i).Tag.Get("yaml")
if jsonArg == "" || jsonArg == "-" {
continue
}
f := o.Field(i)
var strVal string
switch f.Kind() {
c... | [
"func",
"(",
"c",
"*",
"StoreConfig",
")",
"ConfigMap",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"20",
")",
"\n",
"o",
":=",
"reflect",
".",
"ValueOf",
"(",
"c",
")",
... | // ConfigMap returns a map of stringified config values for easy printing | [
"ConfigMap",
"returns",
"a",
"map",
"of",
"stringified",
"config",
"values",
"for",
"easy",
"printing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/store_config.go#L52-L83 |
28,711 | gopasspw/gopass | pkg/store/root/mount.go | RemoveMount | func (r *Store) RemoveMount(ctx context.Context, alias string) error {
if _, found := r.mounts[alias]; !found {
return errors.Errorf("%s is not mounted", alias)
}
if _, found := r.mounts[alias]; !found {
out.Yellow(ctx, "%s is not initialized", alias)
}
delete(r.mounts, alias)
delete(r.cfg.Mounts, alias)
ret... | go | func (r *Store) RemoveMount(ctx context.Context, alias string) error {
if _, found := r.mounts[alias]; !found {
return errors.Errorf("%s is not mounted", alias)
}
if _, found := r.mounts[alias]; !found {
out.Yellow(ctx, "%s is not initialized", alias)
}
delete(r.mounts, alias)
delete(r.cfg.Mounts, alias)
ret... | [
"func",
"(",
"r",
"*",
"Store",
")",
"RemoveMount",
"(",
"ctx",
"context",
".",
"Context",
",",
"alias",
"string",
")",
"error",
"{",
"if",
"_",
",",
"found",
":=",
"r",
".",
"mounts",
"[",
"alias",
"]",
";",
"!",
"found",
"{",
"return",
"errors",
... | // RemoveMount removes and existing mount | [
"RemoveMount",
"removes",
"and",
"existing",
"mount"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L128-L138 |
28,712 | gopasspw/gopass | pkg/store/root/mount.go | Mounts | func (r *Store) Mounts() map[string]string {
m := make(map[string]string, len(r.mounts))
for alias, sub := range r.mounts {
m[alias] = sub.Path()
}
return m
} | go | func (r *Store) Mounts() map[string]string {
m := make(map[string]string, len(r.mounts))
for alias, sub := range r.mounts {
m[alias] = sub.Path()
}
return m
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"Mounts",
"(",
")",
"map",
"[",
"string",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"r",
".",
"mounts",
")",
")",
"\n",
"for",
"alias",
",",
"sub",
"... | // Mounts returns a map of mounts with their paths | [
"Mounts",
"returns",
"a",
"map",
"of",
"mounts",
"with",
"their",
"paths"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L141-L147 |
28,713 | gopasspw/gopass | pkg/store/root/mount.go | MountPoints | func (r *Store) MountPoints() []string {
mps := make([]string, 0, len(r.mounts))
for k := range r.mounts {
mps = append(mps, k)
}
sort.Sort(sort.Reverse(store.ByPathLen(mps)))
return mps
} | go | func (r *Store) MountPoints() []string {
mps := make([]string, 0, len(r.mounts))
for k := range r.mounts {
mps = append(mps, k)
}
sort.Sort(sort.Reverse(store.ByPathLen(mps)))
return mps
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"MountPoints",
"(",
")",
"[",
"]",
"string",
"{",
"mps",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"r",
".",
"mounts",
")",
")",
"\n",
"for",
"k",
":=",
"range",
"r",
".",
"mounts",... | // MountPoints returns a sorted list of mount points. It encodes the logic that
// the longer a mount point the more specific it is. This allows to "shadow" a
// shorter mount point by a longer one. | [
"MountPoints",
"returns",
"a",
"sorted",
"list",
"of",
"mount",
"points",
".",
"It",
"encodes",
"the",
"logic",
"that",
"the",
"longer",
"a",
"mount",
"point",
"the",
"more",
"specific",
"it",
"is",
".",
"This",
"allows",
"to",
"shadow",
"a",
"shorter",
... | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L152-L159 |
28,714 | gopasspw/gopass | pkg/store/root/mount.go | MountPoint | func (r *Store) MountPoint(name string) string {
for _, mp := range r.MountPoints() {
if strings.HasPrefix(name+"/", mp+"/") {
return mp
}
}
return ""
} | go | func (r *Store) MountPoint(name string) string {
for _, mp := range r.MountPoints() {
if strings.HasPrefix(name+"/", mp+"/") {
return mp
}
}
return ""
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"MountPoint",
"(",
"name",
"string",
")",
"string",
"{",
"for",
"_",
",",
"mp",
":=",
"range",
"r",
".",
"MountPoints",
"(",
")",
"{",
"if",
"strings",
".",
"HasPrefix",
"(",
"name",
"+",
"\"",
"\"",
",",
"mp"... | // MountPoint returns the most-specific mount point for the given key | [
"MountPoint",
"returns",
"the",
"most",
"-",
"specific",
"mount",
"point",
"for",
"the",
"given",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L162-L169 |
28,715 | gopasspw/gopass | pkg/store/root/mount.go | getStore | func (r *Store) getStore(ctx context.Context, name string) (context.Context, store.Store, string) {
name = strings.TrimSuffix(name, "/")
mp := r.MountPoint(name)
if sub, found := r.mounts[mp]; found {
return r.cfg.Mounts[mp].WithContext(ctx), sub, strings.TrimPrefix(name, sub.Alias())
}
return r.cfg.Root.WithCon... | go | func (r *Store) getStore(ctx context.Context, name string) (context.Context, store.Store, string) {
name = strings.TrimSuffix(name, "/")
mp := r.MountPoint(name)
if sub, found := r.mounts[mp]; found {
return r.cfg.Mounts[mp].WithContext(ctx), sub, strings.TrimPrefix(name, sub.Alias())
}
return r.cfg.Root.WithCon... | [
"func",
"(",
"r",
"*",
"Store",
")",
"getStore",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"context",
".",
"Context",
",",
"store",
".",
"Store",
",",
"string",
")",
"{",
"name",
"=",
"strings",
".",
"TrimSuffix",
"(",
... | // getStore returns the Store object at the most-specific mount point for the
// given key
// context with sub store options set, sub store reference, truncated path to secret | [
"getStore",
"returns",
"the",
"Store",
"object",
"at",
"the",
"most",
"-",
"specific",
"mount",
"point",
"for",
"the",
"given",
"key",
"context",
"with",
"sub",
"store",
"options",
"set",
"sub",
"store",
"reference",
"truncated",
"path",
"to",
"secret"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L174-L181 |
28,716 | gopasspw/gopass | pkg/store/root/mount.go | WithConfig | func (r *Store) WithConfig(ctx context.Context, name string) context.Context {
name = strings.TrimSuffix(name, "/")
mp := r.MountPoint(name)
if _, found := r.mounts[mp]; found {
return r.cfg.Mounts[mp].WithContext(ctx)
}
return r.cfg.Root.WithContext(ctx)
} | go | func (r *Store) WithConfig(ctx context.Context, name string) context.Context {
name = strings.TrimSuffix(name, "/")
mp := r.MountPoint(name)
if _, found := r.mounts[mp]; found {
return r.cfg.Mounts[mp].WithContext(ctx)
}
return r.cfg.Root.WithContext(ctx)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"WithConfig",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"context",
".",
"Context",
"{",
"name",
"=",
"strings",
".",
"TrimSuffix",
"(",
"name",
",",
"\"",
"\"",
")",
"\n",
"mp",
":=",
"r... | // WithConfig populates the context with the substore config | [
"WithConfig",
"populates",
"the",
"context",
"with",
"the",
"substore",
"config"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L184-L191 |
28,717 | gopasspw/gopass | pkg/store/root/mount.go | GetSubStore | func (r *Store) GetSubStore(name string) (store.Store, error) {
if name == "" {
return r.store, nil
}
if sub, found := r.mounts[name]; found {
return sub, nil
}
return nil, errors.Errorf("no such mount point '%s'", name)
} | go | func (r *Store) GetSubStore(name string) (store.Store, error) {
if name == "" {
return r.store, nil
}
if sub, found := r.mounts[name]; found {
return sub, nil
}
return nil, errors.Errorf("no such mount point '%s'", name)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GetSubStore",
"(",
"name",
"string",
")",
"(",
"store",
".",
"Store",
",",
"error",
")",
"{",
"if",
"name",
"==",
"\"",
"\"",
"{",
"return",
"r",
".",
"store",
",",
"nil",
"\n",
"}",
"\n",
"if",
"sub",
",",... | // GetSubStore returns an exact match for a mount point or an error if this
// mount point does not exist | [
"GetSubStore",
"returns",
"an",
"exact",
"match",
"for",
"a",
"mount",
"point",
"or",
"an",
"error",
"if",
"this",
"mount",
"point",
"does",
"not",
"exist"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L195-L203 |
28,718 | gopasspw/gopass | pkg/store/root/mount.go | checkMounts | func (r *Store) checkMounts() error {
paths := make(map[string]string, len(r.mounts))
for k, v := range r.mounts {
if _, found := paths[v.Path()]; found {
return errors.Errorf("Doubly mounted path at %s: %s", v.Path(), k)
}
paths[v.Path()] = k
}
return nil
} | go | func (r *Store) checkMounts() error {
paths := make(map[string]string, len(r.mounts))
for k, v := range r.mounts {
if _, found := paths[v.Path()]; found {
return errors.Errorf("Doubly mounted path at %s: %s", v.Path(), k)
}
paths[v.Path()] = k
}
return nil
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"checkMounts",
"(",
")",
"error",
"{",
"paths",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"string",
",",
"len",
"(",
"r",
".",
"mounts",
")",
")",
"\n",
"for",
"k",
",",
"v",
":=",
"range",
"r",
".",
"... | // checkMounts performs some sanity checks on our mounts. At the moment it
// only checks if some path is mounted twice. | [
"checkMounts",
"performs",
"some",
"sanity",
"checks",
"on",
"our",
"mounts",
".",
"At",
"the",
"moment",
"it",
"only",
"checks",
"if",
"some",
"path",
"is",
"mounted",
"twice",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/mount.go#L207-L216 |
28,719 | gopasspw/gopass | pkg/action/version.go | Version | func (s *Action) Version(ctx context.Context, c *cli.Context) error {
version := make(chan string, 1)
go s.checkVersion(ctx, version)
_ = s.Initialized(ctx, c)
cli.VersionPrinter(c)
cryptoVer := versionInfo(ctx, s.Store.Crypto(ctx, ""))
rcsVer := versionInfo(ctx, s.Store.RCS(ctx, ""))
storageVer := versionInf... | go | func (s *Action) Version(ctx context.Context, c *cli.Context) error {
version := make(chan string, 1)
go s.checkVersion(ctx, version)
_ = s.Initialized(ctx, c)
cli.VersionPrinter(c)
cryptoVer := versionInfo(ctx, s.Store.Crypto(ctx, ""))
rcsVer := versionInfo(ctx, s.Store.RCS(ctx, ""))
storageVer := versionInf... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Version",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"version",
":=",
"make",
"(",
"chan",
"string",
",",
"1",
")",
"\n",
"go",
"s",
".",
"checkVersion",
... | // Version prints the gopass version | [
"Version",
"prints",
"the",
"gopass",
"version"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/version.go#L21-L63 |
28,720 | gopasspw/gopass | pkg/clipboard/kill_ps.go | killPrecedessors | func killPrecedessors() error {
procs, err := ps.Processes()
if err != nil {
return err
}
for _, proc := range procs {
walkFn(proc.Pid(), killProc)
}
return nil
} | go | func killPrecedessors() error {
procs, err := ps.Processes()
if err != nil {
return err
}
for _, proc := range procs {
walkFn(proc.Pid(), killProc)
}
return nil
} | [
"func",
"killPrecedessors",
"(",
")",
"error",
"{",
"procs",
",",
"err",
":=",
"ps",
".",
"Processes",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"for",
"_",
",",
"proc",
":=",
"range",
"procs",
"{",
"walkFn",
... | // killPrecedessors will kill any previous "gopass unclip" invokations to avoid
// erasing the clipboard prematurely in case the the same content is copied to
// the clipboard repeatedly | [
"killPrecedessors",
"will",
"kill",
"any",
"previous",
"gopass",
"unclip",
"invokations",
"to",
"avoid",
"erasing",
"the",
"clipboard",
"prematurely",
"in",
"case",
"the",
"the",
"same",
"content",
"is",
"copied",
"to",
"the",
"clipboard",
"repeatedly"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/clipboard/kill_ps.go#L12-L21 |
28,721 | gopasspw/gopass | pkg/tpl/template.go | Execute | func Execute(ctx context.Context, tpl, name string, content []byte, s kvstore) ([]byte, error) {
funcs := funcMap(ctx, s)
pl := payload{
Dir: filepath.Dir(name),
Path: name,
Name: filepath.Base(name),
Content: string(content),
}
tmpl, err := template.New(tpl).Funcs(funcs).Parse(tpl)
if err != ni... | go | func Execute(ctx context.Context, tpl, name string, content []byte, s kvstore) ([]byte, error) {
funcs := funcMap(ctx, s)
pl := payload{
Dir: filepath.Dir(name),
Path: name,
Name: filepath.Base(name),
Content: string(content),
}
tmpl, err := template.New(tpl).Funcs(funcs).Parse(tpl)
if err != ni... | [
"func",
"Execute",
"(",
"ctx",
"context",
".",
"Context",
",",
"tpl",
",",
"name",
"string",
",",
"content",
"[",
"]",
"byte",
",",
"s",
"kvstore",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"funcs",
":=",
"funcMap",
"(",
"ctx",
",",
"s"... | // Execute executes the given template | [
"Execute",
"executes",
"the",
"given",
"template"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tpl/template.go#L24-L44 |
28,722 | gopasspw/gopass | pkg/store/secret/yaml.go | Value | func (s *Secret) Value(key string) (string, error) {
s.Lock()
defer s.Unlock()
if s.data == nil {
if !strings.HasPrefix(s.body, "---\n") {
return "", store.ErrYAMLNoMark
}
if err := s.decode(); err != nil {
return "", err
}
}
if v, found := s.data[key]; found {
return fmt.Sprintf("%v", v), nil
}
... | go | func (s *Secret) Value(key string) (string, error) {
s.Lock()
defer s.Unlock()
if s.data == nil {
if !strings.HasPrefix(s.body, "---\n") {
return "", store.ErrYAMLNoMark
}
if err := s.decode(); err != nil {
return "", err
}
}
if v, found := s.data[key]; found {
return fmt.Sprintf("%v", v), nil
}
... | [
"func",
"(",
"s",
"*",
"Secret",
")",
"Value",
"(",
"key",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"data",
"==",
"nil",
"{",
"if",
... | // Value returns the value of the given key if the body contained valid
// YAML | [
"Value",
"returns",
"the",
"value",
"of",
"the",
"given",
"key",
"if",
"the",
"body",
"contained",
"valid",
"YAML"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/yaml.go#L14-L30 |
28,723 | gopasspw/gopass | pkg/store/secret/yaml.go | SetValue | func (s *Secret) SetValue(key, value string) error {
s.Lock()
defer s.Unlock()
if s.body == "" && s.data == nil {
s.data = make(map[string]interface{}, 1)
}
if s.data == nil {
return store.ErrYAMLNoMark
}
s.data[key] = value
return s.encode()
} | go | func (s *Secret) SetValue(key, value string) error {
s.Lock()
defer s.Unlock()
if s.body == "" && s.data == nil {
s.data = make(map[string]interface{}, 1)
}
if s.data == nil {
return store.ErrYAMLNoMark
}
s.data[key] = value
return s.encode()
} | [
"func",
"(",
"s",
"*",
"Secret",
")",
"SetValue",
"(",
"key",
",",
"value",
"string",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"body",
"==",
"\"",
"\"",
"&&",
"s",
"."... | // SetValue sets a key to a given value. Will fail if an non-empty body exists | [
"SetValue",
"sets",
"a",
"key",
"to",
"a",
"given",
"value",
".",
"Will",
"fail",
"if",
"an",
"non",
"-",
"empty",
"body",
"exists"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/yaml.go#L33-L45 |
28,724 | gopasspw/gopass | pkg/store/secret/yaml.go | DeleteKey | func (s *Secret) DeleteKey(key string) error {
s.Lock()
defer s.Unlock()
if s.data == nil {
return store.ErrYAMLNoMark
}
delete(s.data, key)
return s.encode()
} | go | func (s *Secret) DeleteKey(key string) error {
s.Lock()
defer s.Unlock()
if s.data == nil {
return store.ErrYAMLNoMark
}
delete(s.data, key)
return s.encode()
} | [
"func",
"(",
"s",
"*",
"Secret",
")",
"DeleteKey",
"(",
"key",
"string",
")",
"error",
"{",
"s",
".",
"Lock",
"(",
")",
"\n",
"defer",
"s",
".",
"Unlock",
"(",
")",
"\n\n",
"if",
"s",
".",
"data",
"==",
"nil",
"{",
"return",
"store",
".",
"ErrY... | // DeleteKey key will delete a single key from an decoded map | [
"DeleteKey",
"key",
"will",
"delete",
"a",
"single",
"key",
"from",
"an",
"decoded",
"map"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/yaml.go#L48-L57 |
28,725 | gopasspw/gopass | pkg/store/secret/yaml.go | decodeYAML | func (s *Secret) decodeYAML() (bool, error) {
if !strings.HasPrefix(s.body, "---\n") && s.password != "---" {
return false, nil
}
d := make(map[string]interface{})
err := yaml.Unmarshal([]byte(s.body), &d)
if err != nil {
return true, err
}
s.data = d
return true, nil
} | go | func (s *Secret) decodeYAML() (bool, error) {
if !strings.HasPrefix(s.body, "---\n") && s.password != "---" {
return false, nil
}
d := make(map[string]interface{})
err := yaml.Unmarshal([]byte(s.body), &d)
if err != nil {
return true, err
}
s.data = d
return true, nil
} | [
"func",
"(",
"s",
"*",
"Secret",
")",
"decodeYAML",
"(",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"!",
"strings",
".",
"HasPrefix",
"(",
"s",
".",
"body",
",",
"\"",
"\\n",
"\"",
")",
"&&",
"s",
".",
"password",
"!=",
"\"",
"\"",
"{",
... | // decodeYAML attempts to decode an optional YAML part of a secret | [
"decodeYAML",
"attempts",
"to",
"decode",
"an",
"optional",
"YAML",
"part",
"of",
"a",
"secret"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/secret/yaml.go#L60-L71 |
28,726 | gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/keyring.go | ListPublicKeyIDs | func (g *GPG) ListPublicKeyIDs(context.Context) ([]string, error) {
if g.pubring == nil {
return nil, fmt.Errorf("pubring is not initialized")
}
ids := listKeyIDs(g.pubring)
if g.secring != nil {
ids = append(ids, listKeyIDs(g.secring)...)
}
return ids, nil
} | go | func (g *GPG) ListPublicKeyIDs(context.Context) ([]string, error) {
if g.pubring == nil {
return nil, fmt.Errorf("pubring is not initialized")
}
ids := listKeyIDs(g.pubring)
if g.secring != nil {
ids = append(ids, listKeyIDs(g.secring)...)
}
return ids, nil
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"ListPublicKeyIDs",
"(",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"g",
".",
"pubring",
"==",
"nil",
"{",
"return",
"nil",
",",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",... | // ListPublicKeyIDs does nothing | [
"ListPublicKeyIDs",
"does",
"nothing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/keyring.go#L15-L24 |
28,727 | gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/keyring.go | KeysByIdUsage | func (g *GPG) KeysByIdUsage(id uint64, requiredUsage byte) []openpgp.Key {
return append(g.secring.KeysByIdUsage(id, requiredUsage), g.pubring.KeysByIdUsage(id, requiredUsage)...)
} | go | func (g *GPG) KeysByIdUsage(id uint64, requiredUsage byte) []openpgp.Key {
return append(g.secring.KeysByIdUsage(id, requiredUsage), g.pubring.KeysByIdUsage(id, requiredUsage)...)
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"KeysByIdUsage",
"(",
"id",
"uint64",
",",
"requiredUsage",
"byte",
")",
"[",
"]",
"openpgp",
".",
"Key",
"{",
"return",
"append",
"(",
"g",
".",
"secring",
".",
"KeysByIdUsage",
"(",
"id",
",",
"requiredUsage",
")",
... | // KeysByIdUsage implements openpgp.Keyring | [
"KeysByIdUsage",
"implements",
"openpgp",
".",
"Keyring"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/keyring.go#L137-L139 |
28,728 | gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/keyring.go | SigningKeys | func (g *GPG) SigningKeys() []openpgp.Key {
keys := []openpgp.Key{}
for _, e := range g.secring {
for _, subKey := range e.Subkeys {
if subKey.PrivateKey != nil && (!subKey.Sig.FlagsValid || subKey.Sig.FlagSign) {
keys = append(keys, openpgp.Key{
Entity: e,
PublicKey: subKey.PublicKey,
... | go | func (g *GPG) SigningKeys() []openpgp.Key {
keys := []openpgp.Key{}
for _, e := range g.secring {
for _, subKey := range e.Subkeys {
if subKey.PrivateKey != nil && (!subKey.Sig.FlagsValid || subKey.Sig.FlagSign) {
keys = append(keys, openpgp.Key{
Entity: e,
PublicKey: subKey.PublicKey,
... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"SigningKeys",
"(",
")",
"[",
"]",
"openpgp",
".",
"Key",
"{",
"keys",
":=",
"[",
"]",
"openpgp",
".",
"Key",
"{",
"}",
"\n",
"for",
"_",
",",
"e",
":=",
"range",
"g",
".",
"secring",
"{",
"for",
"_",
",",
... | // SigningKeys returns a list of signing keys | [
"SigningKeys",
"returns",
"a",
"list",
"of",
"signing",
"keys"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/keyring.go#L149-L164 |
28,729 | gopasspw/gopass | pkg/jsonapi/helpers.go | isPublicSuffix | func isPublicSuffix(host string) bool {
suffix, _ := publicsuffix.PublicSuffix(host)
return host == suffix
} | go | func isPublicSuffix(host string) bool {
suffix, _ := publicsuffix.PublicSuffix(host)
return host == suffix
} | [
"func",
"isPublicSuffix",
"(",
"host",
"string",
")",
"bool",
"{",
"suffix",
",",
"_",
":=",
"publicsuffix",
".",
"PublicSuffix",
"(",
"host",
")",
"\n",
"return",
"host",
"==",
"suffix",
"\n",
"}"
] | // isPublicSuffix returns true if this host is one users can or could directly
// register names | [
"isPublicSuffix",
"returns",
"true",
"if",
"this",
"host",
"is",
"one",
"users",
"can",
"or",
"could",
"directly",
"register",
"names"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/helpers.go#L12-L15 |
28,730 | gopasspw/gopass | pkg/store/sub/recipients.go | Recipients | func (s *Store) Recipients(ctx context.Context) []string {
rs, err := s.GetRecipients(ctx, "")
if err != nil {
out.Error(ctx, "failed to read recipient list: %s", err)
}
return rs
} | go | func (s *Store) Recipients(ctx context.Context) []string {
rs, err := s.GetRecipients(ctx, "")
if err != nil {
out.Error(ctx, "failed to read recipient list: %s", err)
}
return rs
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"Recipients",
"(",
"ctx",
"context",
".",
"Context",
")",
"[",
"]",
"string",
"{",
"rs",
",",
"err",
":=",
"s",
".",
"GetRecipients",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"o... | // Recipients returns the list of recipients of this store | [
"Recipients",
"returns",
"the",
"list",
"of",
"recipients",
"of",
"this",
"store"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L30-L36 |
28,731 | gopasspw/gopass | pkg/store/sub/recipients.go | AddRecipient | func (s *Store) AddRecipient(ctx context.Context, id string) error {
rs, err := s.GetRecipients(ctx, "")
if err != nil {
return errors.Wrapf(err, "failed to read recipient list")
}
for _, k := range rs {
if k == id {
return errors.Errorf("Recipient already in store")
}
}
rs = append(rs, id)
if err :=... | go | func (s *Store) AddRecipient(ctx context.Context, id string) error {
rs, err := s.GetRecipients(ctx, "")
if err != nil {
return errors.Wrapf(err, "failed to read recipient list")
}
for _, k := range rs {
if k == id {
return errors.Errorf("Recipient already in store")
}
}
rs = append(rs, id)
if err :=... | [
"func",
"(",
"s",
"*",
"Store",
")",
"AddRecipient",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"error",
"{",
"rs",
",",
"err",
":=",
"s",
".",
"GetRecipients",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil... | // AddRecipient adds a new recipient to the list | [
"AddRecipient",
"adds",
"a",
"new",
"recipient",
"to",
"the",
"list"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L39-L59 |
28,732 | gopasspw/gopass | pkg/store/sub/recipients.go | SaveRecipients | func (s *Store) SaveRecipients(ctx context.Context) error {
rs, err := s.GetRecipients(ctx, "")
if err != nil {
return errors.Wrapf(err, "failed to get recipients")
}
return s.saveRecipients(ctx, rs, "Save Recipients", true)
} | go | func (s *Store) SaveRecipients(ctx context.Context) error {
rs, err := s.GetRecipients(ctx, "")
if err != nil {
return errors.Wrapf(err, "failed to get recipients")
}
return s.saveRecipients(ctx, rs, "Save Recipients", true)
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"SaveRecipients",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"rs",
",",
"err",
":=",
"s",
".",
"GetRecipients",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"... | // SaveRecipients persists the current recipients on disk | [
"SaveRecipients",
"persists",
"the",
"current",
"recipients",
"on",
"disk"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L62-L68 |
28,733 | gopasspw/gopass | pkg/store/sub/recipients.go | SetRecipients | func (s *Store) SetRecipients(ctx context.Context, rs []string) error {
return s.saveRecipients(ctx, rs, "Set Recipients", true)
} | go | func (s *Store) SetRecipients(ctx context.Context, rs []string) error {
return s.saveRecipients(ctx, rs, "Set Recipients", true)
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"SetRecipients",
"(",
"ctx",
"context",
".",
"Context",
",",
"rs",
"[",
"]",
"string",
")",
"error",
"{",
"return",
"s",
".",
"saveRecipients",
"(",
"ctx",
",",
"rs",
",",
"\"",
"\"",
",",
"true",
")",
"\n",
"... | // SetRecipients will update the stored recipients and the associated checksum | [
"SetRecipients",
"will",
"update",
"the",
"stored",
"recipients",
"and",
"the",
"associated",
"checksum"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L71-L73 |
28,734 | gopasspw/gopass | pkg/store/sub/recipients.go | RemoveRecipient | func (s *Store) RemoveRecipient(ctx context.Context, id string) error {
keys, err := s.crypto.FindPublicKeys(ctx, id)
if err != nil {
out.Cyan(ctx, "Warning: Failed to get GPG Key Info for %s: %s", id, err)
}
rs, err := s.GetRecipients(ctx, "")
if err != nil {
return errors.Wrapf(err, "failed to read recipien... | go | func (s *Store) RemoveRecipient(ctx context.Context, id string) error {
keys, err := s.crypto.FindPublicKeys(ctx, id)
if err != nil {
out.Cyan(ctx, "Warning: Failed to get GPG Key Info for %s: %s", id, err)
}
rs, err := s.GetRecipients(ctx, "")
if err != nil {
return errors.Wrapf(err, "failed to read recipien... | [
"func",
"(",
"s",
"*",
"Store",
")",
"RemoveRecipient",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"error",
"{",
"keys",
",",
"err",
":=",
"s",
".",
"crypto",
".",
"FindPublicKeys",
"(",
"ctx",
",",
"id",
")",
"\n",
"if",
"err... | // RemoveRecipient will remove the given recipient from the store
// but if this key is not available on this machine we
// just try to remove it literally | [
"RemoveRecipient",
"will",
"remove",
"the",
"given",
"recipient",
"from",
"the",
"store",
"but",
"if",
"this",
"key",
"is",
"not",
"available",
"on",
"this",
"machine",
"we",
"just",
"try",
"to",
"remove",
"it",
"literally"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L78-L114 |
28,735 | gopasspw/gopass | pkg/store/sub/recipients.go | ExportMissingPublicKeys | func (s *Store) ExportMissingPublicKeys(ctx context.Context, rs []string) (bool, error) {
ok := true
exported := false
for _, r := range rs {
if r == "" {
continue
}
path, err := s.exportPublicKey(ctx, r)
if err != nil {
ok = false
out.Error(ctx, "failed to export public key for '%s': %s", r, err)
... | go | func (s *Store) ExportMissingPublicKeys(ctx context.Context, rs []string) (bool, error) {
ok := true
exported := false
for _, r := range rs {
if r == "" {
continue
}
path, err := s.exportPublicKey(ctx, r)
if err != nil {
ok = false
out.Error(ctx, "failed to export public key for '%s': %s", r, err)
... | [
"func",
"(",
"s",
"*",
"Store",
")",
"ExportMissingPublicKeys",
"(",
"ctx",
"context",
".",
"Context",
",",
"rs",
"[",
"]",
"string",
")",
"(",
"bool",
",",
"error",
")",
"{",
"ok",
":=",
"true",
"\n",
"exported",
":=",
"false",
"\n",
"for",
"_",
"... | // ExportMissingPublicKeys will export any possibly missing public keys to the
// stores .public-keys directory | [
"ExportMissingPublicKeys",
"will",
"export",
"any",
"possibly",
"missing",
"public",
"keys",
"to",
"the",
"stores",
".",
"public",
"-",
"keys",
"directory"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L179-L215 |
28,736 | gopasspw/gopass | pkg/store/sub/recipients.go | unmarshalRecipients | func unmarshalRecipients(buf []byte) []string {
m := make(map[string]struct{}, 5)
scanner := bufio.NewScanner(bytes.NewReader(buf))
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line != "" {
// deduplicate
m[line] = struct{}{}
}
}
lst := make([]string, 0, len(m))
for k := range m... | go | func unmarshalRecipients(buf []byte) []string {
m := make(map[string]struct{}, 5)
scanner := bufio.NewScanner(bytes.NewReader(buf))
for scanner.Scan() {
line := strings.TrimSpace(scanner.Text())
if line != "" {
// deduplicate
m[line] = struct{}{}
}
}
lst := make([]string, 0, len(m))
for k := range m... | [
"func",
"unmarshalRecipients",
"(",
"buf",
"[",
"]",
"byte",
")",
"[",
"]",
"string",
"{",
"m",
":=",
"make",
"(",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
",",
"5",
")",
"\n",
"scanner",
":=",
"bufio",
".",
"NewScanner",
"(",
"bytes",
".",
... | // unmarshal Recipients line by line from a io.Reader. | [
"unmarshal",
"Recipients",
"line",
"by",
"line",
"from",
"a",
"io",
".",
"Reader",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/recipients.go#L302-L322 |
28,737 | gopasspw/gopass | pkg/out/print.go | Print | func Print(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprintf(Stdout, Prefix(ctx)+format+newline(ctx), args...)
} | go | func Print(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprintf(Stdout, Prefix(ctx)+format+newline(ctx), args...)
} | [
"func",
"Print",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}"... | // Print formats and prints the given string | [
"Print",
"formats",
"and",
"prints",
"the",
"given",
"string"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L31-L36 |
28,738 | gopasspw/gopass | pkg/out/print.go | Debug | func Debug(ctx context.Context, format string, args ...interface{}) {
if !ctxutil.IsDebug(ctx) {
return
}
var loc string
if _, file, line, ok := runtime.Caller(1); ok {
file = file[strings.Index(file, "pkg/"):]
file = strings.TrimPrefix(file, "pkg/")
loc = fmt.Sprintf("%s:%d ", file, line)
}
fmt.Fprintf... | go | func Debug(ctx context.Context, format string, args ...interface{}) {
if !ctxutil.IsDebug(ctx) {
return
}
var loc string
if _, file, line, ok := runtime.Caller(1); ok {
file = file[strings.Index(file, "pkg/"):]
file = strings.TrimPrefix(file, "pkg/")
loc = fmt.Sprintf("%s:%d ", file, line)
}
fmt.Fprintf... | [
"func",
"Debug",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}",
"\n\n",
"var",
"loc",
"string",
"... | // Debug prints the given string if the debug flag is set | [
"Debug",
"prints",
"the",
"given",
"string",
"if",
"the",
"debug",
"flag",
"is",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L39-L52 |
28,739 | gopasspw/gopass | pkg/out/print.go | Black | func Black(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.BlackString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Black(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.BlackString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Black",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}"... | // Black prints the string in black | [
"Black",
"prints",
"the",
"string",
"in",
"black"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L55-L60 |
28,740 | gopasspw/gopass | pkg/out/print.go | Blue | func Blue(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.BlueString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Blue(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.BlueString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Blue",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}",... | // Blue prints the string in blue | [
"Blue",
"prints",
"the",
"string",
"in",
"blue"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L63-L68 |
28,741 | gopasspw/gopass | pkg/out/print.go | Cyan | func Cyan(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.CyanString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Cyan(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.CyanString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Cyan",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}",... | // Cyan prints the string in cyan | [
"Cyan",
"prints",
"the",
"string",
"in",
"cyan"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L71-L76 |
28,742 | gopasspw/gopass | pkg/out/print.go | Green | func Green(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.GreenString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Green(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.GreenString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Green",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}"... | // Green prints the string in green | [
"Green",
"prints",
"the",
"string",
"in",
"green"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L79-L84 |
28,743 | gopasspw/gopass | pkg/out/print.go | Magenta | func Magenta(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.MagentaString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Magenta(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.MagentaString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Magenta",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"... | // Magenta prints the string in magenta | [
"Magenta",
"prints",
"the",
"string",
"in",
"magenta"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L87-L92 |
28,744 | gopasspw/gopass | pkg/out/print.go | Red | func Red(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.RedString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Red(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.RedString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Red",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}",
... | // Red prints the string in red | [
"Red",
"prints",
"the",
"string",
"in",
"red"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L95-L100 |
28,745 | gopasspw/gopass | pkg/out/print.go | Error | func Error(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stderr, color.RedString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Error(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stderr, color.RedString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Error",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}"... | // Error prints the string in red to stderr | [
"Error",
"prints",
"the",
"string",
"in",
"red",
"to",
"stderr"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L103-L108 |
28,746 | gopasspw/gopass | pkg/out/print.go | White | func White(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.WhiteString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func White(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.WhiteString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"White",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}"... | // White prints the string in white | [
"White",
"prints",
"the",
"string",
"in",
"white"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L111-L116 |
28,747 | gopasspw/gopass | pkg/out/print.go | Yellow | func Yellow(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.YellowString(Prefix(ctx)+format+newline(ctx), args...))
} | go | func Yellow(ctx context.Context, format string, args ...interface{}) {
if IsHidden(ctx) && !ctxutil.IsDebug(ctx) {
return
}
fmt.Fprint(Stdout, color.YellowString(Prefix(ctx)+format+newline(ctx), args...))
} | [
"func",
"Yellow",
"(",
"ctx",
"context",
".",
"Context",
",",
"format",
"string",
",",
"args",
"...",
"interface",
"{",
"}",
")",
"{",
"if",
"IsHidden",
"(",
"ctx",
")",
"&&",
"!",
"ctxutil",
".",
"IsDebug",
"(",
"ctx",
")",
"{",
"return",
"\n",
"}... | // Yellow prints the string in yellow | [
"Yellow",
"prints",
"the",
"string",
"in",
"yellow"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/out/print.go#L119-L124 |
28,748 | gopasspw/gopass | pkg/tree/simple/folder.go | Len | func (f *Folder) Len() int {
l := len(f.Files)
for _, f := range f.Folders {
l += f.Len()
}
return l
} | go | func (f *Folder) Len() int {
l := len(f.Files)
for _, f := range f.Folders {
l += f.Len()
}
return l
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"Len",
"(",
")",
"int",
"{",
"l",
":=",
"len",
"(",
"f",
".",
"Files",
")",
"\n",
"for",
"_",
",",
"f",
":=",
"range",
"f",
".",
"Folders",
"{",
"l",
"+=",
"f",
".",
"Len",
"(",
")",
"\n",
"}",
"\n",
... | // Len returns the number of entries in this folder and all subfolder including
// this folder itself | [
"Len",
"returns",
"the",
"number",
"of",
"entries",
"in",
"this",
"folder",
"and",
"all",
"subfolder",
"including",
"this",
"folder",
"itself"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L26-L32 |
28,749 | gopasspw/gopass | pkg/tree/simple/folder.go | Format | func (f *Folder) Format(maxDepth int) string {
return f.format("", true, maxDepth, 0)
} | go | func (f *Folder) Format(maxDepth int) string {
return f.format("", true, maxDepth, 0)
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"Format",
"(",
"maxDepth",
"int",
")",
"string",
"{",
"return",
"f",
".",
"format",
"(",
"\"",
"\"",
",",
"true",
",",
"maxDepth",
",",
"0",
")",
"\n",
"}"
] | // Format returns a pretty printed tree | [
"Format",
"returns",
"a",
"pretty",
"printed",
"tree"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L48-L50 |
28,750 | gopasspw/gopass | pkg/tree/simple/folder.go | AddFile | func (f *Folder) AddFile(name string, contentType string) error {
return f.addFile(strings.Split(name, sep), contentType)
} | go | func (f *Folder) AddFile(name string, contentType string) error {
return f.addFile(strings.Split(name, sep), contentType)
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"AddFile",
"(",
"name",
"string",
",",
"contentType",
"string",
")",
"error",
"{",
"return",
"f",
".",
"addFile",
"(",
"strings",
".",
"Split",
"(",
"name",
",",
"sep",
")",
",",
"contentType",
")",
"\n",
"}"
] | // AddFile adds a new file | [
"AddFile",
"adds",
"a",
"new",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L58-L60 |
28,751 | gopasspw/gopass | pkg/tree/simple/folder.go | AddTemplate | func (f *Folder) AddTemplate(name string) error {
return f.addTemplate(strings.Split(name, sep))
} | go | func (f *Folder) AddTemplate(name string) error {
return f.addTemplate(strings.Split(name, sep))
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"AddTemplate",
"(",
"name",
"string",
")",
"error",
"{",
"return",
"f",
".",
"addTemplate",
"(",
"strings",
".",
"Split",
"(",
"name",
",",
"sep",
")",
")",
"\n",
"}"
] | // AddTemplate adds a new template | [
"AddTemplate",
"adds",
"a",
"new",
"template"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L68-L70 |
28,752 | gopasspw/gopass | pkg/tree/simple/folder.go | newFolder | func newFolder(name string) *Folder {
return &Folder{
Name: name,
Path: "",
Folders: make(map[string]*Folder, 10),
Files: make(map[string]*File, 10),
}
} | go | func newFolder(name string) *Folder {
return &Folder{
Name: name,
Path: "",
Folders: make(map[string]*Folder, 10),
Files: make(map[string]*File, 10),
}
} | [
"func",
"newFolder",
"(",
"name",
"string",
")",
"*",
"Folder",
"{",
"return",
"&",
"Folder",
"{",
"Name",
":",
"name",
",",
"Path",
":",
"\"",
"\"",
",",
"Folders",
":",
"make",
"(",
"map",
"[",
"string",
"]",
"*",
"Folder",
",",
"10",
")",
",",... | // newFolder creates a new, initialized folder | [
"newFolder",
"creates",
"a",
"new",
"initialized",
"folder"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L73-L80 |
28,753 | gopasspw/gopass | pkg/tree/simple/folder.go | getFolder | func (f *Folder) getFolder(name string) *Folder {
if next, found := f.Folders[name]; found {
return next
}
next := newFolder(name)
f.Folders[name] = next
return next
} | go | func (f *Folder) getFolder(name string) *Folder {
if next, found := f.Folders[name]; found {
return next
}
next := newFolder(name)
f.Folders[name] = next
return next
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"getFolder",
"(",
"name",
"string",
")",
"*",
"Folder",
"{",
"if",
"next",
",",
"found",
":=",
"f",
".",
"Folders",
"[",
"name",
"]",
";",
"found",
"{",
"return",
"next",
"\n",
"}",
"\n",
"next",
":=",
"newFo... | // getFolder returns a direct sub-folder within this folder.
// name MUST NOT include filepath separators. If there is no
// such folder a new one is created with that name. | [
"getFolder",
"returns",
"a",
"direct",
"sub",
"-",
"folder",
"within",
"this",
"folder",
".",
"name",
"MUST",
"NOT",
"include",
"filepath",
"separators",
".",
"If",
"there",
"is",
"no",
"such",
"folder",
"a",
"new",
"one",
"is",
"created",
"with",
"that",
... | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L193-L200 |
28,754 | gopasspw/gopass | pkg/tree/simple/folder.go | FindFolder | func (f *Folder) FindFolder(name string) (tree.Tree, error) {
sub := f.findFolder(strings.Split(strings.TrimSuffix(name, sep), sep))
if sub == nil {
return nil, errors.Errorf("Entry not found")
}
return sub, nil
} | go | func (f *Folder) FindFolder(name string) (tree.Tree, error) {
sub := f.findFolder(strings.Split(strings.TrimSuffix(name, sep), sep))
if sub == nil {
return nil, errors.Errorf("Entry not found")
}
return sub, nil
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"FindFolder",
"(",
"name",
"string",
")",
"(",
"tree",
".",
"Tree",
",",
"error",
")",
"{",
"sub",
":=",
"f",
".",
"findFolder",
"(",
"strings",
".",
"Split",
"(",
"strings",
".",
"TrimSuffix",
"(",
"name",
","... | // FindFolder returns a sub-tree or nil, if the subtree does not exist | [
"FindFolder",
"returns",
"a",
"sub",
"-",
"tree",
"or",
"nil",
"if",
"the",
"subtree",
"does",
"not",
"exist"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L203-L209 |
28,755 | gopasspw/gopass | pkg/tree/simple/folder.go | findFolder | func (f *Folder) findFolder(path []string) *Folder {
if len(path) < 1 {
return f
}
name := path[0]
if next, found := f.Folders[name]; found {
return next.findFolder(path[1:])
}
return nil
} | go | func (f *Folder) findFolder(path []string) *Folder {
if len(path) < 1 {
return f
}
name := path[0]
if next, found := f.Folders[name]; found {
return next.findFolder(path[1:])
}
return nil
} | [
"func",
"(",
"f",
"*",
"Folder",
")",
"findFolder",
"(",
"path",
"[",
"]",
"string",
")",
"*",
"Folder",
"{",
"if",
"len",
"(",
"path",
")",
"<",
"1",
"{",
"return",
"f",
"\n",
"}",
"\n",
"name",
":=",
"path",
"[",
"0",
"]",
"\n",
"if",
"next... | // findFolder recursively tries to find the named sub-folder | [
"findFolder",
"recursively",
"tries",
"to",
"find",
"the",
"named",
"sub",
"-",
"folder"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L212-L221 |
28,756 | gopasspw/gopass | pkg/tree/simple/folder.go | addFile | func (f *Folder) addFile(path []string, contentType string) error {
if len(path) < 1 {
return errors.Errorf("Path must not be empty")
}
name := path[0]
if len(path) == 1 {
if _, found := f.Files[name]; found {
return errors.Errorf("File %s exists", name)
}
f.Files[name] = &File{
Name: name,
Metadat... | go | func (f *Folder) addFile(path []string, contentType string) error {
if len(path) < 1 {
return errors.Errorf("Path must not be empty")
}
name := path[0]
if len(path) == 1 {
if _, found := f.Files[name]; found {
return errors.Errorf("File %s exists", name)
}
f.Files[name] = &File{
Name: name,
Metadat... | [
"func",
"(",
"f",
"*",
"Folder",
")",
"addFile",
"(",
"path",
"[",
"]",
"string",
",",
"contentType",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"path",
")",
"<",
"1",
"{",
"return",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
... | // addFile adds new file | [
"addFile",
"adds",
"new",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/folder.go#L224-L243 |
28,757 | gopasspw/gopass | pkg/jsonapi/api.go | ReadAndRespond | func (api *API) ReadAndRespond(ctx context.Context) error {
silentCtx := out.WithHidden(ctx, true)
message, err := readMessage(api.Reader)
if message == nil || err != nil {
return err
}
return api.respondMessage(silentCtx, message)
} | go | func (api *API) ReadAndRespond(ctx context.Context) error {
silentCtx := out.WithHidden(ctx, true)
message, err := readMessage(api.Reader)
if message == nil || err != nil {
return err
}
return api.respondMessage(silentCtx, message)
} | [
"func",
"(",
"api",
"*",
"API",
")",
"ReadAndRespond",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"silentCtx",
":=",
"out",
".",
"WithHidden",
"(",
"ctx",
",",
"true",
")",
"\n",
"message",
",",
"err",
":=",
"readMessage",
"(",
"api",
... | // ReadAndRespond a single message | [
"ReadAndRespond",
"a",
"single",
"message"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/api.go#L21-L29 |
28,758 | gopasspw/gopass | pkg/jsonapi/api.go | RespondError | func (api *API) RespondError(err error) error {
var response errorResponse
response.Error = err.Error()
return sendSerializedJSONMessage(response, api.Writer)
} | go | func (api *API) RespondError(err error) error {
var response errorResponse
response.Error = err.Error()
return sendSerializedJSONMessage(response, api.Writer)
} | [
"func",
"(",
"api",
"*",
"API",
")",
"RespondError",
"(",
"err",
"error",
")",
"error",
"{",
"var",
"response",
"errorResponse",
"\n",
"response",
".",
"Error",
"=",
"err",
".",
"Error",
"(",
")",
"\n\n",
"return",
"sendSerializedJSONMessage",
"(",
"respon... | // RespondError sends err as JSON response | [
"RespondError",
"sends",
"err",
"as",
"JSON",
"response"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/api.go#L32-L37 |
28,759 | gopasspw/gopass | pkg/pinentry/pinentry.go | New | func New() (*Client, error) {
cmd := exec.Command(GetBinary())
stdin, err := cmd.StdinPipe()
if err != nil {
return nil, err
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return nil, err
}
br := bufio.NewReader(stdout)
if err := cmd.Start(); err != nil {
return nil, err
}
// check welcome messag... | go | func New() (*Client, error) {
cmd := exec.Command(GetBinary())
stdin, err := cmd.StdinPipe()
if err != nil {
return nil, err
}
stdout, err := cmd.StdoutPipe()
if err != nil {
return nil, err
}
br := bufio.NewReader(stdout)
if err := cmd.Start(); err != nil {
return nil, err
}
// check welcome messag... | [
"func",
"New",
"(",
")",
"(",
"*",
"Client",
",",
"error",
")",
"{",
"cmd",
":=",
"exec",
".",
"Command",
"(",
"GetBinary",
"(",
")",
")",
"\n",
"stdin",
",",
"err",
":=",
"cmd",
".",
"StdinPipe",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
... | // New creates a new pinentry client | [
"New",
"creates",
"a",
"new",
"pinentry",
"client"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pinentry/pinentry.go#L22-L55 |
28,760 | gopasspw/gopass | pkg/pinentry/pinentry.go | Confirm | func (c *Client) Confirm() bool {
if err := c.Set("confirm", ""); err == nil {
return true
}
return false
} | go | func (c *Client) Confirm() bool {
if err := c.Set("confirm", ""); err == nil {
return true
}
return false
} | [
"func",
"(",
"c",
"*",
"Client",
")",
"Confirm",
"(",
")",
"bool",
"{",
"if",
"err",
":=",
"c",
".",
"Set",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
";",
"err",
"==",
"nil",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
"false",
"\n",
"}"
] | // Confirm sends the confirm message | [
"Confirm",
"sends",
"the",
"confirm",
"message"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pinentry/pinentry.go#L63-L68 |
28,761 | gopasspw/gopass | pkg/pinentry/pinentry.go | Set | func (c *Client) Set(key, value string) error {
key = strings.ToUpper(key)
if value != "" {
value = " " + value
}
val := "SET" + key + value + "\n"
if _, err := c.in.Write([]byte(val)); err != nil {
return err
}
line, _, _ := c.out.ReadLine()
if string(line) != "OK" {
return errors.Errorf("error: %s", lin... | go | func (c *Client) Set(key, value string) error {
key = strings.ToUpper(key)
if value != "" {
value = " " + value
}
val := "SET" + key + value + "\n"
if _, err := c.in.Write([]byte(val)); err != nil {
return err
}
line, _, _ := c.out.ReadLine()
if string(line) != "OK" {
return errors.Errorf("error: %s", lin... | [
"func",
"(",
"c",
"*",
"Client",
")",
"Set",
"(",
"key",
",",
"value",
"string",
")",
"error",
"{",
"key",
"=",
"strings",
".",
"ToUpper",
"(",
"key",
")",
"\n",
"if",
"value",
"!=",
"\"",
"\"",
"{",
"value",
"=",
"\"",
"\"",
"+",
"value",
"\n"... | // Set sets a key | [
"Set",
"sets",
"a",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pinentry/pinentry.go#L71-L85 |
28,762 | gopasspw/gopass | pkg/pinentry/pinentry.go | GetPin | func (c *Client) GetPin() ([]byte, error) {
if _, err := c.in.Write([]byte("GETPIN\n")); err != nil {
return nil, err
}
pin, _, err := c.out.ReadLine()
if err != nil {
return nil, err
}
if bytes.HasPrefix(pin, []byte("OK")) {
return nil, nil
}
if !bytes.HasPrefix(pin, []byte("D ")) {
return nil, fmt.Err... | go | func (c *Client) GetPin() ([]byte, error) {
if _, err := c.in.Write([]byte("GETPIN\n")); err != nil {
return nil, err
}
pin, _, err := c.out.ReadLine()
if err != nil {
return nil, err
}
if bytes.HasPrefix(pin, []byte("OK")) {
return nil, nil
}
if !bytes.HasPrefix(pin, []byte("D ")) {
return nil, fmt.Err... | [
"func",
"(",
"c",
"*",
"Client",
")",
"GetPin",
"(",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"if",
"_",
",",
"err",
":=",
"c",
".",
"in",
".",
"Write",
"(",
"[",
"]",
"byte",
"(",
"\"",
"\\n",
"\"",
")",
")",
";",
"err",
"!=",... | // GetPin asks for the pin | [
"GetPin",
"asks",
"for",
"the",
"pin"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/pinentry/pinentry.go#L88-L111 |
28,763 | gopasspw/gopass | pkg/action/config.go | Config | func (s *Action) Config(ctx context.Context, c *cli.Context) error {
if len(c.Args()) < 1 {
s.printConfigValues(ctx, "")
return nil
}
if len(c.Args()) == 1 {
s.printConfigValues(ctx, "", c.Args()[0])
return nil
}
if len(c.Args()) > 2 {
return ExitError(ctx, ExitUsage, nil, "Usage: %s config key value",... | go | func (s *Action) Config(ctx context.Context, c *cli.Context) error {
if len(c.Args()) < 1 {
s.printConfigValues(ctx, "")
return nil
}
if len(c.Args()) == 1 {
s.printConfigValues(ctx, "", c.Args()[0])
return nil
}
if len(c.Args()) > 2 {
return ExitError(ctx, ExitUsage, nil, "Usage: %s config key value",... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Config",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"len",
"(",
"c",
".",
"Args",
"(",
")",
")",
"<",
"1",
"{",
"s",
".",
"printConfigValues",
"("... | // Config handles changes to the gopass configuration | [
"Config",
"handles",
"changes",
"to",
"the",
"gopass",
"configuration"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/config.go#L15-L34 |
28,764 | gopasspw/gopass | pkg/action/config.go | ConfigComplete | func (s *Action) ConfigComplete(c *cli.Context) {
cm := s.cfg.Root.ConfigMap()
keys := make([]string, 0, len(cm))
for k := range cm {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
fmt.Fprintln(stdout, k)
}
} | go | func (s *Action) ConfigComplete(c *cli.Context) {
cm := s.cfg.Root.ConfigMap()
keys := make([]string, 0, len(cm))
for k := range cm {
keys = append(keys, k)
}
sort.Strings(keys)
for _, k := range keys {
fmt.Fprintln(stdout, k)
}
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"ConfigComplete",
"(",
"c",
"*",
"cli",
".",
"Context",
")",
"{",
"cm",
":=",
"s",
".",
"cfg",
".",
"Root",
".",
"ConfigMap",
"(",
")",
"\n",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
... | // ConfigComplete will print the list of valid config keys | [
"ConfigComplete",
"will",
"print",
"the",
"list",
"of",
"valid",
"config",
"keys"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/config.go#L101-L111 |
28,765 | gopasspw/gopass | pkg/fsutil/umask.go | Umask | func Umask() int {
for _, en := range []string{"GOPASS_UMASK", "PASSWORD_STORE_UMASK"} {
if um := os.Getenv(en); um != "" {
if iv, err := strconv.ParseInt(um, 8, 32); err == nil && iv >= 0 && iv <= 0777 {
return int(iv)
}
}
}
return 077
} | go | func Umask() int {
for _, en := range []string{"GOPASS_UMASK", "PASSWORD_STORE_UMASK"} {
if um := os.Getenv(en); um != "" {
if iv, err := strconv.ParseInt(um, 8, 32); err == nil && iv >= 0 && iv <= 0777 {
return int(iv)
}
}
}
return 077
} | [
"func",
"Umask",
"(",
")",
"int",
"{",
"for",
"_",
",",
"en",
":=",
"range",
"[",
"]",
"string",
"{",
"\"",
"\"",
",",
"\"",
"\"",
"}",
"{",
"if",
"um",
":=",
"os",
".",
"Getenv",
"(",
"en",
")",
";",
"um",
"!=",
"\"",
"\"",
"{",
"if",
"i... | // Umask extracts the umask from env | [
"Umask",
"extracts",
"the",
"umask",
"from",
"env"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/fsutil/umask.go#L9-L18 |
28,766 | gopasspw/gopass | pkg/store/root/init.go | Initialized | func (r *Store) Initialized(ctx context.Context) (bool, error) {
if r.store == nil {
out.Debug(ctx, "initializing store and possible sub-stores")
if err := r.initialize(ctx); err != nil {
return false, errors.Wrapf(err, "failed to initialized stores: %s", err)
}
}
return r.store.Initialized(ctx), nil
} | go | func (r *Store) Initialized(ctx context.Context) (bool, error) {
if r.store == nil {
out.Debug(ctx, "initializing store and possible sub-stores")
if err := r.initialize(ctx); err != nil {
return false, errors.Wrapf(err, "failed to initialized stores: %s", err)
}
}
return r.store.Initialized(ctx), nil
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"Initialized",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"bool",
",",
"error",
")",
"{",
"if",
"r",
".",
"store",
"==",
"nil",
"{",
"out",
".",
"Debug",
"(",
"ctx",
",",
"\"",
"\"",
")",
"\n",
"if",
... | // Initialized checks on disk if .gpg-id was generated and thus returns true. | [
"Initialized",
"checks",
"on",
"disk",
"if",
".",
"gpg",
"-",
"id",
"was",
"generated",
"and",
"thus",
"returns",
"true",
"."
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/init.go#L16-L24 |
28,767 | gopasspw/gopass | pkg/hibp/api/client.go | Lookup | func Lookup(ctx context.Context, shaSum string) (uint64, error) {
if len(shaSum) != 40 {
return 0, errors.Errorf("invalid shasum")
}
shaSum = strings.ToUpper(shaSum)
prefix := shaSum[:5]
suffix := shaSum[5:]
var count uint64
url := fmt.Sprintf("%s/range/%s", URL, prefix)
op := func() error {
out.Debug(ct... | go | func Lookup(ctx context.Context, shaSum string) (uint64, error) {
if len(shaSum) != 40 {
return 0, errors.Errorf("invalid shasum")
}
shaSum = strings.ToUpper(shaSum)
prefix := shaSum[:5]
suffix := shaSum[5:]
var count uint64
url := fmt.Sprintf("%s/range/%s", URL, prefix)
op := func() error {
out.Debug(ct... | [
"func",
"Lookup",
"(",
"ctx",
"context",
".",
"Context",
",",
"shaSum",
"string",
")",
"(",
"uint64",
",",
"error",
")",
"{",
"if",
"len",
"(",
"shaSum",
")",
"!=",
"40",
"{",
"return",
"0",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n... | // Lookup performs a lookup against the HIBP v2 API | [
"Lookup",
"performs",
"a",
"lookup",
"against",
"the",
"HIBP",
"v2",
"API"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/hibp/api/client.go#L22-L78 |
28,768 | gopasspw/gopass | pkg/action/git.go | GitInit | func (s *Action) GitInit(ctx context.Context, c *cli.Context) error {
store := c.String("store")
un := c.String("username")
ue := c.String("useremail")
ctx = backend.WithRCSBackendString(ctx, c.String("rcs"))
// default to git
if !backend.HasRCSBackend(ctx) {
ctx = backend.WithRCSBackend(ctx, backend.GitCLI)
... | go | func (s *Action) GitInit(ctx context.Context, c *cli.Context) error {
store := c.String("store")
un := c.String("username")
ue := c.String("useremail")
ctx = backend.WithRCSBackendString(ctx, c.String("rcs"))
// default to git
if !backend.HasRCSBackend(ctx) {
ctx = backend.WithRCSBackend(ctx, backend.GitCLI)
... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitInit",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"store",
":=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"un",
":=",
"c",
".",
"String",
"(",... | // GitInit initializes a git repo including basic configuration | [
"GitInit",
"initializes",
"a",
"git",
"repo",
"including",
"basic",
"configuration"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git.go#L18-L33 |
28,769 | gopasspw/gopass | pkg/action/git.go | GitAddRemote | func (s *Action) GitAddRemote(ctx context.Context, c *cli.Context) error {
store := c.String("store")
remote := c.Args().Get(0)
url := c.Args().Get(1)
if remote == "" || url == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s git remote add <REMOTE> <URL>", s.Name)
}
return s.Store.GitAddRemote(ctx, stor... | go | func (s *Action) GitAddRemote(ctx context.Context, c *cli.Context) error {
store := c.String("store")
remote := c.Args().Get(0)
url := c.Args().Get(1)
if remote == "" || url == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s git remote add <REMOTE> <URL>", s.Name)
}
return s.Store.GitAddRemote(ctx, stor... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitAddRemote",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"store",
":=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"remote",
":=",
"c",
".",
"Args",... | // GitAddRemote adds a new git remote | [
"GitAddRemote",
"adds",
"a",
"new",
"git",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git.go#L79-L89 |
28,770 | gopasspw/gopass | pkg/action/git.go | GitPull | func (s *Action) GitPull(ctx context.Context, c *cli.Context) error {
store := c.String("store")
origin := c.Args().Get(0)
branch := c.Args().Get(1)
if origin == "" {
origin = "origin"
}
if branch == "" {
branch = "master"
}
return s.Store.GitPull(ctx, store, origin, branch)
} | go | func (s *Action) GitPull(ctx context.Context, c *cli.Context) error {
store := c.String("store")
origin := c.Args().Get(0)
branch := c.Args().Get(1)
if origin == "" {
origin = "origin"
}
if branch == "" {
branch = "master"
}
return s.Store.GitPull(ctx, store, origin, branch)
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitPull",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"store",
":=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"origin",
":=",
"c",
".",
"Args",
"(... | // GitPull pulls from a git remote | [
"GitPull",
"pulls",
"from",
"a",
"git",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git.go#L104-L116 |
28,771 | gopasspw/gopass | pkg/action/git.go | GitPush | func (s *Action) GitPush(ctx context.Context, c *cli.Context) error {
store := c.String("store")
origin := c.Args().Get(0)
branch := c.Args().Get(1)
if origin == "" || branch == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s git push <ORIGIN> <BRANCH>", s.Name)
}
return s.Store.GitPush(ctx, store, origi... | go | func (s *Action) GitPush(ctx context.Context, c *cli.Context) error {
store := c.String("store")
origin := c.Args().Get(0)
branch := c.Args().Get(1)
if origin == "" || branch == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s git push <ORIGIN> <BRANCH>", s.Name)
}
return s.Store.GitPush(ctx, store, origi... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitPush",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"store",
":=",
"c",
".",
"String",
"(",
"\"",
"\"",
")",
"\n",
"origin",
":=",
"c",
".",
"Args",
"(... | // GitPush pushes to a git remote | [
"GitPush",
"pushes",
"to",
"a",
"git",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git.go#L119-L128 |
28,772 | gopasspw/gopass | pkg/store/sub/store.go | New | func New(ctx context.Context, sc recipientHashStorer, alias string, u *backend.URL, cfgdir string, agent *client.Client) (*Store, error) {
out.Debug(ctx, "sub.New - URL: %s", u.String())
s := &Store{
alias: alias,
url: u,
rcs: noop.New(),
cfgdir: cfgdir,
agent: agent,
sc: sc,
}
// init sto... | go | func New(ctx context.Context, sc recipientHashStorer, alias string, u *backend.URL, cfgdir string, agent *client.Client) (*Store, error) {
out.Debug(ctx, "sub.New - URL: %s", u.String())
s := &Store{
alias: alias,
url: u,
rcs: noop.New(),
cfgdir: cfgdir,
agent: agent,
sc: sc,
}
// init sto... | [
"func",
"New",
"(",
"ctx",
"context",
".",
"Context",
",",
"sc",
"recipientHashStorer",
",",
"alias",
"string",
",",
"u",
"*",
"backend",
".",
"URL",
",",
"cfgdir",
"string",
",",
"agent",
"*",
"client",
".",
"Client",
")",
"(",
"*",
"Store",
",",
"e... | // New creates a new store, copying settings from the given root store | [
"New",
"creates",
"a",
"new",
"store",
"copying",
"settings",
"from",
"the",
"given",
"root",
"store"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/store.go#L42-L83 |
28,773 | gopasspw/gopass | pkg/store/sub/store.go | idFile | func (s *Store) idFile(ctx context.Context, name string) string {
fn := name
var cnt uint8
for {
cnt++
if cnt > 100 {
break
}
if fn == "" || fn == sep {
break
}
gfn := filepath.Join(fn, s.crypto.IDFile())
if s.storage.Exists(ctx, gfn) {
return gfn
}
fn = filepath.Dir(fn)
}
return s.crypt... | go | func (s *Store) idFile(ctx context.Context, name string) string {
fn := name
var cnt uint8
for {
cnt++
if cnt > 100 {
break
}
if fn == "" || fn == sep {
break
}
gfn := filepath.Join(fn, s.crypto.IDFile())
if s.storage.Exists(ctx, gfn) {
return gfn
}
fn = filepath.Dir(fn)
}
return s.crypt... | [
"func",
"(",
"s",
"*",
"Store",
")",
"idFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"string",
"{",
"fn",
":=",
"name",
"\n",
"var",
"cnt",
"uint8",
"\n",
"for",
"{",
"cnt",
"++",
"\n",
"if",
"cnt",
">",
"100",
"{",
... | // idFile returns the path to the recipient list for this.storage
// it walks up from the given filename until it finds a directory containing
// a gpg id file or it leaves the scope of this.storage. | [
"idFile",
"returns",
"the",
"path",
"to",
"the",
"recipient",
"list",
"for",
"this",
".",
"storage",
"it",
"walks",
"up",
"from",
"the",
"given",
"filename",
"until",
"it",
"finds",
"a",
"directory",
"containing",
"a",
"gpg",
"id",
"file",
"or",
"it",
"l... | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/store.go#L88-L106 |
28,774 | gopasspw/gopass | pkg/store/sub/store.go | Equals | func (s *Store) Equals(other store.Store) bool {
if other == nil {
return false
}
return s.URL() == other.URL()
} | go | func (s *Store) Equals(other store.Store) bool {
if other == nil {
return false
}
return s.URL() == other.URL()
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"Equals",
"(",
"other",
"store",
".",
"Store",
")",
"bool",
"{",
"if",
"other",
"==",
"nil",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return",
"s",
".",
"URL",
"(",
")",
"==",
"other",
".",
"URL",
"(",
")",... | // Equals returns true if this.storage has the same on-disk path as the other | [
"Equals",
"returns",
"true",
"if",
"this",
".",
"storage",
"has",
"the",
"same",
"on",
"-",
"disk",
"path",
"as",
"the",
"other"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/store.go#L109-L114 |
28,775 | gopasspw/gopass | pkg/store/sub/store.go | IsDir | func (s *Store) IsDir(ctx context.Context, name string) bool {
return s.storage.IsDir(ctx, name)
} | go | func (s *Store) IsDir(ctx context.Context, name string) bool {
return s.storage.IsDir(ctx, name)
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"IsDir",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"bool",
"{",
"return",
"s",
".",
"storage",
".",
"IsDir",
"(",
"ctx",
",",
"name",
")",
"\n",
"}"
] | // IsDir returns true if the entry is folder inside the store | [
"IsDir",
"returns",
"true",
"if",
"the",
"entry",
"is",
"folder",
"inside",
"the",
"store"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/store.go#L117-L119 |
28,776 | gopasspw/gopass | pkg/store/sub/store.go | Path | func (s *Store) Path() string {
if s.url == nil {
return ""
}
return s.url.Path
} | go | func (s *Store) Path() string {
if s.url == nil {
return ""
}
return s.url.Path
} | [
"func",
"(",
"s",
"*",
"Store",
")",
"Path",
"(",
")",
"string",
"{",
"if",
"s",
".",
"url",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"s",
".",
"url",
".",
"Path",
"\n",
"}"
] | // Path returns the value of path | [
"Path",
"returns",
"the",
"value",
"of",
"path"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/store.go#L283-L288 |
28,777 | gopasspw/gopass | pkg/action/xc/xc.go | ListPrivateKeys | func ListPrivateKeys(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
kl, err := crypto.ListPrivateKeyIDs(ctx)
if err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to list priv... | go | func ListPrivateKeys(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
kl, err := crypto.ListPrivateKeyIDs(ctx)
if err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to list priv... | [
"func",
"ListPrivateKeys",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
",",... | // ListPrivateKeys list the XC private keys | [
"ListPrivateKeys",
"list",
"the",
"XC",
"private",
"keys"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L38-L54 |
28,778 | gopasspw/gopass | pkg/action/xc/xc.go | GenerateKeypair | func GenerateKeypair(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
name := c.String("name")
email := c.String("email")
pw := c.String("passphrase")
if name == "" {
var err error
name, err = ter... | go | func GenerateKeypair(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
name := c.String("name")
email := c.String("email")
pw := c.String("passphrase")
if name == "" {
var err error
name, err = ter... | [
"func",
"GenerateKeypair",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
",",... | // GenerateKeypair generates a new XC keypair | [
"GenerateKeypair",
"generates",
"a",
"new",
"XC",
"keypair"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L76-L111 |
28,779 | gopasspw/gopass | pkg/action/xc/xc.go | ExportPrivateKey | func ExportPrivateKey(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
id := c.String("id")
file := c.String("file")
if id == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need id")
}
i... | go | func ExportPrivateKey(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
id := c.String("id")
file := c.String("file")
if id == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need id")
}
i... | [
"func",
"ExportPrivateKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
","... | // ExportPrivateKey exports an XC key | [
"ExportPrivateKey",
"exports",
"an",
"XC",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L183-L211 |
28,780 | gopasspw/gopass | pkg/action/xc/xc.go | ImportPrivateKey | func ImportPrivateKey(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
file := c.String("file")
if file == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need file")
}
if !fsutil.IsFile(... | go | func ImportPrivateKey(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
file := c.String("file")
if file == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need file")
}
if !fsutil.IsFile(... | [
"func",
"ImportPrivateKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
","... | // ImportPrivateKey imports an XC key | [
"ImportPrivateKey",
"imports",
"an",
"XC",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L214-L234 |
28,781 | gopasspw/gopass | pkg/action/xc/xc.go | EncryptFile | func EncryptFile(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
if c.Bool("stream") {
return EncryptFileStream(ctx, c)
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx,... | go | func EncryptFile(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
if c.Bool("stream") {
return EncryptFileStream(ctx, c)
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx,... | [
"func",
"EncryptFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
",",
"... | // EncryptFile encrypts a single file | [
"EncryptFile",
"encrypts",
"a",
"single",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L237-L273 |
28,782 | gopasspw/gopass | pkg/action/xc/xc.go | DecryptFile | func DecryptFile(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
if c.Bool("stream") {
return DecryptFileStream(ctx, c)
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx,... | go | func DecryptFile(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
if c.Bool("stream") {
return DecryptFileStream(ctx, c)
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx,... | [
"func",
"DecryptFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
",",
"... | // DecryptFile decrypts a single file | [
"DecryptFile",
"decrypts",
"a",
"single",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L276-L315 |
28,783 | gopasspw/gopass | pkg/action/xc/xc.go | EncryptFileStream | func EncryptFileStream(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need file")
}
recipients := ... | go | func EncryptFileStream(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need file")
}
recipients := ... | [
"func",
"EncryptFileStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
",... | // EncryptFileStream encrypts a single file | [
"EncryptFileStream",
"encrypts",
"a",
"single",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L318-L356 |
28,784 | gopasspw/gopass | pkg/action/xc/xc.go | DecryptFileStream | func DecryptFileStream(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need file")
}
if !strings.Has... | go | func DecryptFileStream(ctx context.Context, c *cli.Context) error {
if err := initCrypto(); err != nil {
return action.ExitError(ctx, action.ExitUnknown, err, "failed to init XC")
}
inFile := c.String("file")
if inFile == "" {
return action.ExitError(ctx, action.ExitUsage, nil, "need file")
}
if !strings.Has... | [
"func",
"DecryptFileStream",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"err",
":=",
"initCrypto",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"action",
".",
"ExitError",
"(",
"ctx",
",... | // DecryptFileStream decrypts a single file | [
"DecryptFileStream",
"decrypts",
"a",
"single",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/xc/xc.go#L359-L397 |
28,785 | gopasspw/gopass | pkg/action/git-credential.go | WriteTo | func (c *gitCredentials) WriteTo(w io.Writer) (int64, error) {
var n int64
if c.Protocol != "" {
i, err := io.WriteString(w, "protocol="+c.Protocol+"\n")
n += int64(i)
if err != nil {
return n, err
}
}
if c.Host != "" {
i, err := io.WriteString(w, "host="+c.Host+"\n")
n += int64(i)
if err != nil {
... | go | func (c *gitCredentials) WriteTo(w io.Writer) (int64, error) {
var n int64
if c.Protocol != "" {
i, err := io.WriteString(w, "protocol="+c.Protocol+"\n")
n += int64(i)
if err != nil {
return n, err
}
}
if c.Host != "" {
i, err := io.WriteString(w, "host="+c.Host+"\n")
n += int64(i)
if err != nil {
... | [
"func",
"(",
"c",
"*",
"gitCredentials",
")",
"WriteTo",
"(",
"w",
"io",
".",
"Writer",
")",
"(",
"int64",
",",
"error",
")",
"{",
"var",
"n",
"int64",
"\n",
"if",
"c",
".",
"Protocol",
"!=",
"\"",
"\"",
"{",
"i",
",",
"err",
":=",
"io",
".",
... | // WriteTo writes the given credentials to the given io.Writer in the git-credential format | [
"WriteTo",
"writes",
"the",
"given",
"credentials",
"to",
"the",
"given",
"io",
".",
"Writer",
"in",
"the",
"git",
"-",
"credential",
"format"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git-credential.go#L31-L69 |
28,786 | gopasspw/gopass | pkg/action/git-credential.go | GitCredentialBefore | func (s *Action) GitCredentialBefore(ctx context.Context, c *cli.Context) error {
err := s.Initialized(ctx, c)
if err != nil {
return err
}
if !ctxutil.IsStdin(ctx) {
return ExitError(ctx, ExitUsage, nil, "missing stdin from git")
}
return nil
} | go | func (s *Action) GitCredentialBefore(ctx context.Context, c *cli.Context) error {
err := s.Initialized(ctx, c)
if err != nil {
return err
}
if !ctxutil.IsStdin(ctx) {
return ExitError(ctx, ExitUsage, nil, "missing stdin from git")
}
return nil
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitCredentialBefore",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"err",
":=",
"s",
".",
"Initialized",
"(",
"ctx",
",",
"c",
")",
"\n",
"if",
"err",
"!=",
... | // GitCredentialBefore is executed before another git-credential command | [
"GitCredentialBefore",
"is",
"executed",
"before",
"another",
"git",
"-",
"credential",
"command"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git-credential.go#L110-L119 |
28,787 | gopasspw/gopass | pkg/action/git-credential.go | GitCredentialGet | func (s *Action) GitCredentialGet(ctx context.Context, c *cli.Context) error {
ctx = sub.WithAutoSync(ctx, false)
cred, err := parseGitCredentials(termio.Stdin)
if err != nil {
return ExitError(ctx, ExitUnsupported, err, "Error: %v while parsing git-credential", err)
}
// try git/host/username... If username is ... | go | func (s *Action) GitCredentialGet(ctx context.Context, c *cli.Context) error {
ctx = sub.WithAutoSync(ctx, false)
cred, err := parseGitCredentials(termio.Stdin)
if err != nil {
return ExitError(ctx, ExitUnsupported, err, "Error: %v while parsing git-credential", err)
}
// try git/host/username... If username is ... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitCredentialGet",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"ctx",
"=",
"sub",
".",
"WithAutoSync",
"(",
"ctx",
",",
"false",
")",
"\n",
"cred",
",",
"err... | // GitCredentialGet returns a credential to git | [
"GitCredentialGet",
"returns",
"a",
"credential",
"to",
"git"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git-credential.go#L122-L167 |
28,788 | gopasspw/gopass | pkg/action/git-credential.go | GitCredentialStore | func (s *Action) GitCredentialStore(ctx context.Context, c *cli.Context) error {
cred, err := parseGitCredentials(termio.Stdin)
if err != nil {
return ExitError(ctx, ExitUnsupported, err, "Error: %v while parsing git-credential", err)
}
path := "git/" + fsutil.CleanFilename(cred.Host) + "/" + fsutil.CleanFilename... | go | func (s *Action) GitCredentialStore(ctx context.Context, c *cli.Context) error {
cred, err := parseGitCredentials(termio.Stdin)
if err != nil {
return ExitError(ctx, ExitUnsupported, err, "Error: %v while parsing git-credential", err)
}
path := "git/" + fsutil.CleanFilename(cred.Host) + "/" + fsutil.CleanFilename... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitCredentialStore",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"cred",
",",
"err",
":=",
"parseGitCredentials",
"(",
"termio",
".",
"Stdin",
")",
"\n",
"if",
... | // GitCredentialStore stores a credential got from git | [
"GitCredentialStore",
"stores",
"a",
"credential",
"got",
"from",
"git"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git-credential.go#L170-L195 |
28,789 | gopasspw/gopass | pkg/action/git-credential.go | GitCredentialErase | func (s *Action) GitCredentialErase(ctx context.Context, c *cli.Context) error {
cred, err := parseGitCredentials(termio.Stdin)
if err != nil {
return ExitError(ctx, ExitUnsupported, err, "Error: %v while parsing git-credential", err)
}
path := "git/" + fsutil.CleanFilename(cred.Host) + "/" + fsutil.CleanFilename... | go | func (s *Action) GitCredentialErase(ctx context.Context, c *cli.Context) error {
cred, err := parseGitCredentials(termio.Stdin)
if err != nil {
return ExitError(ctx, ExitUnsupported, err, "Error: %v while parsing git-credential", err)
}
path := "git/" + fsutil.CleanFilename(cred.Host) + "/" + fsutil.CleanFilename... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitCredentialErase",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"cred",
",",
"err",
":=",
"parseGitCredentials",
"(",
"termio",
".",
"Stdin",
")",
"\n",
"if",
... | // GitCredentialErase removes a credential got from git | [
"GitCredentialErase",
"removes",
"a",
"credential",
"got",
"from",
"git"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git-credential.go#L198-L209 |
28,790 | gopasspw/gopass | pkg/action/git-credential.go | GitCredentialConfigure | func (s *Action) GitCredentialConfigure(ctx context.Context, c *cli.Context) error {
flags := 0
flag := "--global"
if c.Bool("local") {
flag = "--local"
flags++
}
if c.Bool("global") {
flag = "--global"
flags++
}
if c.Bool("system") {
flag = "--system"
flags++
}
if flags >= 2 {
return ExitError(c... | go | func (s *Action) GitCredentialConfigure(ctx context.Context, c *cli.Context) error {
flags := 0
flag := "--global"
if c.Bool("local") {
flag = "--local"
flags++
}
if c.Bool("global") {
flag = "--global"
flags++
}
if c.Bool("system") {
flag = "--system"
flags++
}
if flags >= 2 {
return ExitError(c... | [
"func",
"(",
"s",
"*",
"Action",
")",
"GitCredentialConfigure",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"flags",
":=",
"0",
"\n",
"flag",
":=",
"\"",
"\"",
"\n",
"if",
"c",
".",
"Bool",
"(",
... | // GitCredentialConfigure configures gopass as git's credential.helper | [
"GitCredentialConfigure",
"configures",
"gopass",
"as",
"git",
"s",
"credential",
".",
"helper"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/git-credential.go#L212-L237 |
28,791 | gopasspw/gopass | pkg/tree/simple/file.go | format | func (f File) format(prefix string, last bool, _, _ int) string {
sym := symBranch
if last {
sym = symLeaf
}
ft := ""
if f.Metadata != nil {
switch f.Metadata["Content-Type"] {
case "application/octet-stream":
ft = " " + colBin("(binary)")
case "text/yaml":
ft = " " + colYaml("(yaml)")
}
}
return... | go | func (f File) format(prefix string, last bool, _, _ int) string {
sym := symBranch
if last {
sym = symLeaf
}
ft := ""
if f.Metadata != nil {
switch f.Metadata["Content-Type"] {
case "application/octet-stream":
ft = " " + colBin("(binary)")
case "text/yaml":
ft = " " + colYaml("(yaml)")
}
}
return... | [
"func",
"(",
"f",
"File",
")",
"format",
"(",
"prefix",
"string",
",",
"last",
"bool",
",",
"_",
",",
"_",
"int",
")",
"string",
"{",
"sym",
":=",
"symBranch",
"\n",
"if",
"last",
"{",
"sym",
"=",
"symLeaf",
"\n",
"}",
"\n",
"ft",
":=",
"\"",
"... | // format will format this leaf node for pretty printing | [
"format",
"will",
"format",
"this",
"leaf",
"node",
"for",
"pretty",
"printing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/file.go#L15-L30 |
28,792 | gopasspw/gopass | pkg/cui/actions.go | Selection | func (ca Actions) Selection() []string {
keys := make([]string, 0, len(ca))
for _, a := range ca {
keys = append(keys, a.Name)
}
return keys
} | go | func (ca Actions) Selection() []string {
keys := make([]string, 0, len(ca))
for _, a := range ca {
keys = append(keys, a.Name)
}
return keys
} | [
"func",
"(",
"ca",
"Actions",
")",
"Selection",
"(",
")",
"[",
"]",
"string",
"{",
"keys",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"ca",
")",
")",
"\n",
"for",
"_",
",",
"a",
":=",
"range",
"ca",
"{",
"keys",
"=",
... | // Selection return the list of actions | [
"Selection",
"return",
"the",
"list",
"of",
"actions"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/cui/actions.go#L20-L26 |
28,793 | gopasspw/gopass | pkg/cui/actions.go | Run | func (ca Actions) Run(ctx context.Context, c *cli.Context, i int) error {
if len(ca) < i || i >= len(ca) {
return errors.New("action not found")
}
if ca[i].Fn == nil {
return errors.New("action invalid")
}
return ca[i].Fn(ctx, c)
} | go | func (ca Actions) Run(ctx context.Context, c *cli.Context, i int) error {
if len(ca) < i || i >= len(ca) {
return errors.New("action not found")
}
if ca[i].Fn == nil {
return errors.New("action invalid")
}
return ca[i].Fn(ctx, c)
} | [
"func",
"(",
"ca",
"Actions",
")",
"Run",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
",",
"i",
"int",
")",
"error",
"{",
"if",
"len",
"(",
"ca",
")",
"<",
"i",
"||",
"i",
">=",
"len",
"(",
"ca",
")",
"{",
"... | // Run executes the selected action | [
"Run",
"executes",
"the",
"selected",
"action"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/cui/actions.go#L29-L37 |
28,794 | gopasspw/gopass | pkg/hibp/dump/scanner.go | New | func New(dumps ...string) (*Scanner, error) {
ok := make([]string, 0, len(dumps))
for _, dump := range dumps {
if !fsutil.IsFile(dump) {
continue
}
ok = append(ok, dump)
}
if len(ok) < 1 {
return nil, fmt.Errorf("no valid dumps given")
}
return &Scanner{
dumps: ok,
}, nil
} | go | func New(dumps ...string) (*Scanner, error) {
ok := make([]string, 0, len(dumps))
for _, dump := range dumps {
if !fsutil.IsFile(dump) {
continue
}
ok = append(ok, dump)
}
if len(ok) < 1 {
return nil, fmt.Errorf("no valid dumps given")
}
return &Scanner{
dumps: ok,
}, nil
} | [
"func",
"New",
"(",
"dumps",
"...",
"string",
")",
"(",
"*",
"Scanner",
",",
"error",
")",
"{",
"ok",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"dumps",
")",
")",
"\n",
"for",
"_",
",",
"dump",
":=",
"range",
"dumps",
... | // New creates a new scanner | [
"New",
"creates",
"a",
"new",
"scanner"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/hibp/dump/scanner.go#L24-L38 |
28,795 | gopasspw/gopass | pkg/hibp/dump/scanner.go | LookupBatch | func (s *Scanner) LookupBatch(ctx context.Context, in []string) []string {
if len(in) < 1 {
return nil
}
sort.Strings(in)
for i, hash := range in {
in[i] = strings.ToUpper(hash)
}
out := make([]string, 0, len(in))
results := make(chan string, len(in))
done := make(chan struct{}, len(s.dumps))
for _, fn ... | go | func (s *Scanner) LookupBatch(ctx context.Context, in []string) []string {
if len(in) < 1 {
return nil
}
sort.Strings(in)
for i, hash := range in {
in[i] = strings.ToUpper(hash)
}
out := make([]string, 0, len(in))
results := make(chan string, len(in))
done := make(chan struct{}, len(s.dumps))
for _, fn ... | [
"func",
"(",
"s",
"*",
"Scanner",
")",
"LookupBatch",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"[",
"]",
"string",
")",
"[",
"]",
"string",
"{",
"if",
"len",
"(",
"in",
")",
"<",
"1",
"{",
"return",
"nil",
"\n",
"}",
"\n\n",
"sort",
".... | // LookupBatch takes a slice SHA1 hashes and matches them against
// the provided dumps | [
"LookupBatch",
"takes",
"a",
"slice",
"SHA1",
"hashes",
"and",
"matches",
"them",
"against",
"the",
"provided",
"dumps"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/hibp/dump/scanner.go#L42-L72 |
28,796 | gopasspw/gopass | pkg/backend/rcs/noop/backend.go | Add | func (g *Noop) Add(ctx context.Context, args ...string) error {
return nil
} | go | func (g *Noop) Add(ctx context.Context, args ...string) error {
return nil
} | [
"func",
"(",
"g",
"*",
"Noop",
")",
"Add",
"(",
"ctx",
"context",
".",
"Context",
",",
"args",
"...",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Add does nothing | [
"Add",
"does",
"nothing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/noop/backend.go#L21-L23 |
28,797 | gopasspw/gopass | pkg/backend/rcs/noop/backend.go | Commit | func (g *Noop) Commit(ctx context.Context, msg string) error {
return nil
} | go | func (g *Noop) Commit(ctx context.Context, msg string) error {
return nil
} | [
"func",
"(",
"g",
"*",
"Noop",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
",",
"msg",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Commit does nothing | [
"Commit",
"does",
"nothing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/noop/backend.go#L26-L28 |
28,798 | gopasspw/gopass | pkg/backend/rcs/noop/backend.go | Push | func (g *Noop) Push(ctx context.Context, origin, branch string) error {
return nil
} | go | func (g *Noop) Push(ctx context.Context, origin, branch string) error {
return nil
} | [
"func",
"(",
"g",
"*",
"Noop",
")",
"Push",
"(",
"ctx",
"context",
".",
"Context",
",",
"origin",
",",
"branch",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Push does nothing | [
"Push",
"does",
"nothing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/noop/backend.go#L31-L33 |
28,799 | gopasspw/gopass | pkg/backend/rcs/noop/backend.go | Cmd | func (g *Noop) Cmd(ctx context.Context, name string, args ...string) error {
return nil
} | go | func (g *Noop) Cmd(ctx context.Context, name string, args ...string) error {
return nil
} | [
"func",
"(",
"g",
"*",
"Noop",
")",
"Cmd",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"args",
"...",
"string",
")",
"error",
"{",
"return",
"nil",
"\n",
"}"
] | // Cmd does nothing | [
"Cmd",
"does",
"nothing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/noop/backend.go#L41-L43 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.