repo stringlengths 5 54 | path stringlengths 4 155 | func_name stringlengths 1 118 | original_string stringlengths 52 85.5k | language stringclasses 1
value | code stringlengths 52 85.5k | code_tokens list | docstring stringlengths 6 2.61k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 85 252 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gopasspw/gopass | pkg/action/edit.go | Edit | func (s *Action) Edit(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
if name == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s edit secret", s.Name)
}
return s.edit(ctx, c, name)
} | go | func (s *Action) Edit(ctx context.Context, c *cli.Context) error {
name := c.Args().First()
if name == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s edit secret", s.Name)
}
return s.edit(ctx, c, name)
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"Edit",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"name",
":=",
"c",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"\n",
"if",
"name",
"==",
"\"",
"\... | // Edit the content of a password file | [
"Edit",
"the",
"content",
"of",
"a",
"password",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/edit.go#L20-L27 | train |
gopasspw/gopass | pkg/backend/crypto/xc/encrypt.go | Encrypt | func (x *XC) Encrypt(ctx context.Context, plaintext []byte, recipients []string) ([]byte, error) {
privKeyIDs := x.secring.KeyIDs()
if len(privKeyIDs) < 1 {
return nil, fmt.Errorf("no signing keys available on our keyring")
}
privKey := x.secring.Get(privKeyIDs[0])
var compressed bool
plaintext, compressed = c... | go | func (x *XC) Encrypt(ctx context.Context, plaintext []byte, recipients []string) ([]byte, error) {
privKeyIDs := x.secring.KeyIDs()
if len(privKeyIDs) < 1 {
return nil, fmt.Errorf("no signing keys available on our keyring")
}
privKey := x.secring.Get(privKeyIDs[0])
var compressed bool
plaintext, compressed = c... | [
"func",
"(",
"x",
"*",
"XC",
")",
"Encrypt",
"(",
"ctx",
"context",
".",
"Context",
",",
"plaintext",
"[",
"]",
"byte",
",",
"recipients",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"privKeyIDs",
":=",
"x",
".",
"secr... | // Encrypt encrypts the given plaintext for all the given recipients and returns the
// ciphertext | [
"Encrypt",
"encrypts",
"the",
"given",
"plaintext",
"for",
"all",
"the",
"given",
"recipients",
"and",
"returns",
"the",
"ciphertext"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/encrypt.go#L32-L62 | train |
gopasspw/gopass | pkg/backend/crypto/xc/encrypt.go | encryptForRecipient | func (x *XC) encryptForRecipient(ctx context.Context, sender *keyring.PrivateKey, sk []byte, recipient string) ([]byte, error) {
recp := x.pubring.Get(recipient)
if recp == nil {
return nil, fmt.Errorf("recipient public key not available for %s", recipient)
}
var recipientPublicKey [32]byte
copy(recipientPublic... | go | func (x *XC) encryptForRecipient(ctx context.Context, sender *keyring.PrivateKey, sk []byte, recipient string) ([]byte, error) {
recp := x.pubring.Get(recipient)
if recp == nil {
return nil, fmt.Errorf("recipient public key not available for %s", recipient)
}
var recipientPublicKey [32]byte
copy(recipientPublic... | [
"func",
"(",
"x",
"*",
"XC",
")",
"encryptForRecipient",
"(",
"ctx",
"context",
".",
"Context",
",",
"sender",
"*",
"keyring",
".",
"PrivateKey",
",",
"sk",
"[",
"]",
"byte",
",",
"recipient",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
... | // encryptForRecipients encrypts the given session key for the given recipient | [
"encryptForRecipients",
"encrypts",
"the",
"given",
"session",
"key",
"for",
"the",
"given",
"recipient"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/encrypt.go#L93-L118 | train |
gopasspw/gopass | pkg/backend/crypto/xc/encrypt.go | encryptBody | func encryptBody(plaintext []byte) ([]byte, []*xcpb.Chunk, error) {
// generate session / encryption key
var sessionKey [32]byte
if _, err := crypto_rand.Read(sessionKey[:]); err != nil {
return nil, nil, err
}
chunks := make([]*xcpb.Chunk, 0, (len(plaintext)/chunkSizeMax)+1)
offset := 0
for offset < len(pla... | go | func encryptBody(plaintext []byte) ([]byte, []*xcpb.Chunk, error) {
// generate session / encryption key
var sessionKey [32]byte
if _, err := crypto_rand.Read(sessionKey[:]); err != nil {
return nil, nil, err
}
chunks := make([]*xcpb.Chunk, 0, (len(plaintext)/chunkSizeMax)+1)
offset := 0
for offset < len(pla... | [
"func",
"encryptBody",
"(",
"plaintext",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"*",
"xcpb",
".",
"Chunk",
",",
"error",
")",
"{",
"// generate session / encryption key",
"var",
"sessionKey",
"[",
"32",
"]",
"byte",
"\n",
"if",
"_... | // encryptBody generates a random session key and a nonce and encrypts the given
// plaintext with those. it returns all three | [
"encryptBody",
"generates",
"a",
"random",
"session",
"key",
"and",
"a",
"nonce",
"and",
"encrypts",
"the",
"given",
"plaintext",
"with",
"those",
".",
"it",
"returns",
"all",
"three"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/xc/encrypt.go#L122-L147 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | listKeys | func (g *GPG) listKeys(ctx context.Context, typ string, search ...string) (gpg.KeyList, error) {
args := []string{"--with-colons", "--with-fingerprint", "--fixed-list-mode", "--list-" + typ + "-keys"}
args = append(args, search...)
if e, found := g.listCache.Get(strings.Join(args, ",")); found {
if ev, ok := e.(gp... | go | func (g *GPG) listKeys(ctx context.Context, typ string, search ...string) (gpg.KeyList, error) {
args := []string{"--with-colons", "--with-fingerprint", "--fixed-list-mode", "--list-" + typ + "-keys"}
args = append(args, search...)
if e, found := g.listCache.Get(strings.Join(args, ",")); found {
if ev, ok := e.(gp... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"listKeys",
"(",
"ctx",
"context",
".",
"Context",
",",
"typ",
"string",
",",
"search",
"...",
"string",
")",
"(",
"gpg",
".",
"KeyList",
",",
"error",
")",
"{",
"args",
":=",
"[",
"]",
"string",
"{",
"\"",
"\""... | // listKey lists all keys of the given type and matching the search strings | [
"listKey",
"lists",
"all",
"keys",
"of",
"the",
"given",
"type",
"and",
"matching",
"the",
"search",
"strings"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L14-L37 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | ListPublicKeyIDs | func (g *GPG) ListPublicKeyIDs(ctx context.Context) ([]string, error) {
if g.pubKeys == nil {
kl, err := g.listKeys(ctx, "public")
if err != nil {
return nil, err
}
g.pubKeys = kl
}
if gpg.IsAlwaysTrust(ctx) {
return g.pubKeys.Recipients(), nil
}
return g.pubKeys.UseableKeys().Recipients(), nil
} | go | func (g *GPG) ListPublicKeyIDs(ctx context.Context) ([]string, error) {
if g.pubKeys == nil {
kl, err := g.listKeys(ctx, "public")
if err != nil {
return nil, err
}
g.pubKeys = kl
}
if gpg.IsAlwaysTrust(ctx) {
return g.pubKeys.Recipients(), nil
}
return g.pubKeys.UseableKeys().Recipients(), nil
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"ListPublicKeyIDs",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"g",
".",
"pubKeys",
"==",
"nil",
"{",
"kl",
",",
"err",
":=",
"g",
".",
"listKeys",
"(",
... | // ListPublicKeyIDs returns a parsed list of GPG public keys | [
"ListPublicKeyIDs",
"returns",
"a",
"parsed",
"list",
"of",
"GPG",
"public",
"keys"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L40-L52 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | FindPublicKeys | func (g *GPG) FindPublicKeys(ctx context.Context, search ...string) ([]string, error) {
kl, err := g.listKeys(ctx, "public", search...)
if err != nil || kl == nil {
return nil, err
}
if gpg.IsAlwaysTrust(ctx) {
return kl.Recipients(), nil
}
return kl.UseableKeys().Recipients(), nil
} | go | func (g *GPG) FindPublicKeys(ctx context.Context, search ...string) ([]string, error) {
kl, err := g.listKeys(ctx, "public", search...)
if err != nil || kl == nil {
return nil, err
}
if gpg.IsAlwaysTrust(ctx) {
return kl.Recipients(), nil
}
return kl.UseableKeys().Recipients(), nil
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"FindPublicKeys",
"(",
"ctx",
"context",
".",
"Context",
",",
"search",
"...",
"string",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"kl",
",",
"err",
":=",
"g",
".",
"listKeys",
"(",
"ctx",
",",
"\"",... | // FindPublicKeys searches for the given public keys | [
"FindPublicKeys",
"searches",
"for",
"the",
"given",
"public",
"keys"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L55-L64 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | ListPrivateKeyIDs | func (g *GPG) ListPrivateKeyIDs(ctx context.Context) ([]string, error) {
if g.privKeys == nil {
kl, err := g.listKeys(ctx, "secret")
if err != nil {
return nil, err
}
g.privKeys = kl
}
if gpg.IsAlwaysTrust(ctx) {
return g.privKeys.Recipients(), nil
}
return g.privKeys.UseableKeys().Recipients(), nil
} | go | func (g *GPG) ListPrivateKeyIDs(ctx context.Context) ([]string, error) {
if g.privKeys == nil {
kl, err := g.listKeys(ctx, "secret")
if err != nil {
return nil, err
}
g.privKeys = kl
}
if gpg.IsAlwaysTrust(ctx) {
return g.privKeys.Recipients(), nil
}
return g.privKeys.UseableKeys().Recipients(), nil
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"ListPrivateKeyIDs",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"if",
"g",
".",
"privKeys",
"==",
"nil",
"{",
"kl",
",",
"err",
":=",
"g",
".",
"listKeys",
"(",
... | // ListPrivateKeyIDs returns a parsed list of GPG secret keys | [
"ListPrivateKeyIDs",
"returns",
"a",
"parsed",
"list",
"of",
"GPG",
"secret",
"keys"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L67-L79 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | EmailFromKey | func (g *GPG) EmailFromKey(ctx context.Context, id string) string {
return g.findKey(ctx, id).Identity().Email
} | go | func (g *GPG) EmailFromKey(ctx context.Context, id string) string {
return g.findKey(ctx, id).Identity().Email
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"EmailFromKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"string",
"{",
"return",
"g",
".",
"findKey",
"(",
"ctx",
",",
"id",
")",
".",
"Identity",
"(",
")",
".",
"Email",
"\n",
"}"
] | // EmailFromKey extracts the email from a key id | [
"EmailFromKey",
"extracts",
"the",
"email",
"from",
"a",
"key",
"id"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L108-L110 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | NameFromKey | func (g *GPG) NameFromKey(ctx context.Context, id string) string {
return g.findKey(ctx, id).Identity().Name
} | go | func (g *GPG) NameFromKey(ctx context.Context, id string) string {
return g.findKey(ctx, id).Identity().Name
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"NameFromKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"string",
"{",
"return",
"g",
".",
"findKey",
"(",
"ctx",
",",
"id",
")",
".",
"Identity",
"(",
")",
".",
"Name",
"\n",
"}"
] | // NameFromKey extracts the name from a key id | [
"NameFromKey",
"extracts",
"the",
"name",
"from",
"a",
"key",
"id"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L113-L115 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/keyring.go | FormatKey | func (g *GPG) FormatKey(ctx context.Context, id string) string {
return g.findKey(ctx, id).OneLine()
} | go | func (g *GPG) FormatKey(ctx context.Context, id string) string {
return g.findKey(ctx, id).OneLine()
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"FormatKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"string",
"{",
"return",
"g",
".",
"findKey",
"(",
"ctx",
",",
"id",
")",
".",
"OneLine",
"(",
")",
"\n",
"}"
] | // FormatKey formats the details of a key id | [
"FormatKey",
"formats",
"the",
"details",
"of",
"a",
"key",
"id"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/keyring.go#L118-L120 | train |
gopasspw/gopass | pkg/action/grep.go | Grep | func (s *Action) Grep(ctx context.Context, c *cli.Context) error {
if !c.Args().Present() {
return ExitError(ctx, ExitUsage, nil, "Usage: %s grep arg", s.Name)
}
// get the search term
needle := c.Args().First()
haystack, err := s.Store.List(ctx, 0)
if err != nil {
return ExitError(ctx, ExitList, err, "fail... | go | func (s *Action) Grep(ctx context.Context, c *cli.Context) error {
if !c.Args().Present() {
return ExitError(ctx, ExitUsage, nil, "Usage: %s grep arg", s.Name)
}
// get the search term
needle := c.Args().First()
haystack, err := s.Store.List(ctx, 0)
if err != nil {
return ExitError(ctx, ExitList, err, "fail... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Grep",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"!",
"c",
".",
"Args",
"(",
")",
".",
"Present",
"(",
")",
"{",
"return",
"ExitError",
"(",
"ctx... | // Grep searches a string inside the content of all files | [
"Grep",
"searches",
"a",
"string",
"inside",
"the",
"content",
"of",
"all",
"files"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/grep.go#L14-L53 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | New | func New(ctx context.Context) (*GPG, error) {
pubfn := filepath.Join(gpgHome(ctx), "pubring.gpg")
pubring, err := readKeyring(pubfn)
if err != nil {
return nil, err
}
secfn := filepath.Join(gpgHome(ctx), "secring.gpg")
secring, err := readKeyring(secfn)
if err != nil {
return nil, err
}
g := &GPG{
pubrin... | go | func New(ctx context.Context) (*GPG, error) {
pubfn := filepath.Join(gpgHome(ctx), "pubring.gpg")
pubring, err := readKeyring(pubfn)
if err != nil {
return nil, err
}
secfn := filepath.Join(gpgHome(ctx), "secring.gpg")
secring, err := readKeyring(secfn)
if err != nil {
return nil, err
}
g := &GPG{
pubrin... | [
"func",
"New",
"(",
"ctx",
"context",
".",
"Context",
")",
"(",
"*",
"GPG",
",",
"error",
")",
"{",
"pubfn",
":=",
"filepath",
".",
"Join",
"(",
"gpgHome",
"(",
"ctx",
")",
",",
"\"",
"\"",
")",
"\n",
"pubring",
",",
"err",
":=",
"readKeyring",
"... | // New creates a new pure-Go GPG backend | [
"New",
"creates",
"a",
"new",
"pure",
"-",
"Go",
"GPG",
"backend"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L30-L48 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | RecipientIDs | func (g *GPG) RecipientIDs(ctx context.Context, ciphertext []byte) ([]string, error) {
recps := make([]string, 0, 1)
packets := packet.NewReader(bytes.NewReader(ciphertext))
for {
p, err := packets.Next()
if err != nil {
if err == io.EOF {
break
}
return nil, err
}
switch p := p.(type) {
case ... | go | func (g *GPG) RecipientIDs(ctx context.Context, ciphertext []byte) ([]string, error) {
recps := make([]string, 0, 1)
packets := packet.NewReader(bytes.NewReader(ciphertext))
for {
p, err := packets.Next()
if err != nil {
if err == io.EOF {
break
}
return nil, err
}
switch p := p.(type) {
case ... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"RecipientIDs",
"(",
"ctx",
"context",
".",
"Context",
",",
"ciphertext",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"recps",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
... | // RecipientIDs returns the recipients of the encrypted message | [
"RecipientIDs",
"returns",
"the",
"recipients",
"of",
"the",
"encrypted",
"message"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L51-L75 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | Encrypt | func (g *GPG) Encrypt(ctx context.Context, plaintext []byte, recipients []string) ([]byte, error) {
ciphertext := &bytes.Buffer{}
ents := g.recipientsToEntities(recipients)
wc, err := openpgp.Encrypt(ciphertext, ents, nil, nil, nil)
if err != nil {
return nil, errors.Wrapf(err, "failed to encrypt")
}
if _, err ... | go | func (g *GPG) Encrypt(ctx context.Context, plaintext []byte, recipients []string) ([]byte, error) {
ciphertext := &bytes.Buffer{}
ents := g.recipientsToEntities(recipients)
wc, err := openpgp.Encrypt(ciphertext, ents, nil, nil, nil)
if err != nil {
return nil, errors.Wrapf(err, "failed to encrypt")
}
if _, err ... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"Encrypt",
"(",
"ctx",
"context",
".",
"Context",
",",
"plaintext",
"[",
"]",
"byte",
",",
"recipients",
"[",
"]",
"string",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"ciphertext",
":=",
"&",
"bytes",
... | // Encrypt encrypts the plaintext for the given recipients | [
"Encrypt",
"encrypts",
"the",
"plaintext",
"for",
"the",
"given",
"recipients"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L78-L92 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | ImportPublicKey | func (g *GPG) ImportPublicKey(ctx context.Context, buf []byte) error {
el, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(buf))
if err != nil {
return err
}
g.pubring = append(g.pubring, el...)
return nil
} | go | func (g *GPG) ImportPublicKey(ctx context.Context, buf []byte) error {
el, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(buf))
if err != nil {
return err
}
g.pubring = append(g.pubring, el...)
return nil
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"ImportPublicKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"buf",
"[",
"]",
"byte",
")",
"error",
"{",
"el",
",",
"err",
":=",
"openpgp",
".",
"ReadArmoredKeyRing",
"(",
"bytes",
".",
"NewReader",
"(",
"buf",
")... | // ImportPublicKey does nothing | [
"ImportPublicKey",
"does",
"nothing"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L121-L128 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | Version | func (g *GPG) Version(context.Context) semver.Version {
return semver.Version{Major: 1}
} | go | func (g *GPG) Version(context.Context) semver.Version {
return semver.Version{Major: 1}
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"Version",
"(",
"context",
".",
"Context",
")",
"semver",
".",
"Version",
"{",
"return",
"semver",
".",
"Version",
"{",
"Major",
":",
"1",
"}",
"\n",
"}"
] | // Version returns dummy version info | [
"Version",
"returns",
"dummy",
"version",
"info"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L131-L133 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | Sign | func (g *GPG) Sign(ctx context.Context, in string, sigf string) error {
signKeys := g.SigningKeys()
if len(signKeys) < 1 {
return fmt.Errorf("no signing keys available")
}
sigfh, err := os.OpenFile(sigf, os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
return err
}
defer sigfh.Close()
wc, err := clearsign.E... | go | func (g *GPG) Sign(ctx context.Context, in string, sigf string) error {
signKeys := g.SigningKeys()
if len(signKeys) < 1 {
return fmt.Errorf("no signing keys available")
}
sigfh, err := os.OpenFile(sigf, os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
return err
}
defer sigfh.Close()
wc, err := clearsign.E... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"Sign",
"(",
"ctx",
"context",
".",
"Context",
",",
"in",
"string",
",",
"sigf",
"string",
")",
"error",
"{",
"signKeys",
":=",
"g",
".",
"SigningKeys",
"(",
")",
"\n",
"if",
"len",
"(",
"signKeys",
")",
"<",
"1... | // Sign is not implemented | [
"Sign",
"is",
"not",
"implemented"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L141-L167 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | Verify | func (g *GPG) Verify(ctx context.Context, sigf string, in string) error {
sig, err := ioutil.ReadFile(sigf)
if err != nil {
return err
}
b, _ := clearsign.Decode(sig)
infh, err := os.Open(in)
if err != nil {
return err
}
defer infh.Close()
_, err = openpgp.CheckDetachedSignature(g.pubring, infh, bytes.NewR... | go | func (g *GPG) Verify(ctx context.Context, sigf string, in string) error {
sig, err := ioutil.ReadFile(sigf)
if err != nil {
return err
}
b, _ := clearsign.Decode(sig)
infh, err := os.Open(in)
if err != nil {
return err
}
defer infh.Close()
_, err = openpgp.CheckDetachedSignature(g.pubring, infh, bytes.NewR... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"Verify",
"(",
"ctx",
"context",
".",
"Context",
",",
"sigf",
"string",
",",
"in",
"string",
")",
"error",
"{",
"sig",
",",
"err",
":=",
"ioutil",
".",
"ReadFile",
"(",
"sigf",
")",
"\n",
"if",
"err",
"!=",
"nil... | // Verify is not implemented | [
"Verify",
"is",
"not",
"implemented"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L170-L186 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | EmailFromKey | func (g *GPG) EmailFromKey(ctx context.Context, id string) string {
ent := g.findEntity(id)
if ent == nil || ent.Identities == nil {
return ""
}
for name, id := range ent.Identities {
if id.UserId == nil {
return name
}
return id.UserId.Email
}
return ""
} | go | func (g *GPG) EmailFromKey(ctx context.Context, id string) string {
ent := g.findEntity(id)
if ent == nil || ent.Identities == nil {
return ""
}
for name, id := range ent.Identities {
if id.UserId == nil {
return name
}
return id.UserId.Email
}
return ""
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"EmailFromKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"string",
"{",
"ent",
":=",
"g",
".",
"findEntity",
"(",
"id",
")",
"\n",
"if",
"ent",
"==",
"nil",
"||",
"ent",
".",
"Identities",
... | // EmailFromKey returns the email for this key | [
"EmailFromKey",
"returns",
"the",
"email",
"for",
"this",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L206-L218 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | NameFromKey | func (g *GPG) NameFromKey(ctx context.Context, id string) string {
ent := g.findEntity(id)
if ent == nil || ent.Identities == nil {
return ""
}
for name, id := range ent.Identities {
if id.UserId == nil {
return name
}
return id.UserId.Name
}
return ""
} | go | func (g *GPG) NameFromKey(ctx context.Context, id string) string {
ent := g.findEntity(id)
if ent == nil || ent.Identities == nil {
return ""
}
for name, id := range ent.Identities {
if id.UserId == nil {
return name
}
return id.UserId.Name
}
return ""
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"NameFromKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"id",
"string",
")",
"string",
"{",
"ent",
":=",
"g",
".",
"findEntity",
"(",
"id",
")",
"\n",
"if",
"ent",
"==",
"nil",
"||",
"ent",
".",
"Identities",
... | // NameFromKey is returns the name for this key | [
"NameFromKey",
"is",
"returns",
"the",
"name",
"for",
"this",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L221-L233 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/gpg.go | ReadNamesFromKey | func (g *GPG) ReadNamesFromKey(ctx context.Context, buf []byte) ([]string, error) {
el, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(buf))
if err != nil {
return nil, errors.Wrapf(err, "failed to read key ring")
}
if len(el) != 1 {
return nil, errors.Errorf("Public Key must contain exactly one Entity")
}
... | go | func (g *GPG) ReadNamesFromKey(ctx context.Context, buf []byte) ([]string, error) {
el, err := openpgp.ReadArmoredKeyRing(bytes.NewReader(buf))
if err != nil {
return nil, errors.Wrapf(err, "failed to read key ring")
}
if len(el) != 1 {
return nil, errors.Errorf("Public Key must contain exactly one Entity")
}
... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"ReadNamesFromKey",
"(",
"ctx",
"context",
".",
"Context",
",",
"buf",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"el",
",",
"err",
":=",
"openpgp",
".",
"ReadArmoredKeyRing",
"(",
"by... | // ReadNamesFromKey unmarshals and returns the names associated with the given public key | [
"ReadNamesFromKey",
"unmarshals",
"and",
"returns",
"the",
"names",
"associated",
"with",
"the",
"given",
"public",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/gpg.go#L277-L290 | train |
gopasspw/gopass | pkg/action/unclip.go | Unclip | func (s *Action) Unclip(ctx context.Context, c *cli.Context) error {
force := c.Bool("force")
timeout := c.Int("timeout")
checksum := os.Getenv("GOPASS_UNCLIP_CHECKSUM")
time.Sleep(time.Second * time.Duration(timeout))
if err := clipboard.Clear(ctx, checksum, force); err != nil {
return ExitError(ctx, ExitIO, e... | go | func (s *Action) Unclip(ctx context.Context, c *cli.Context) error {
force := c.Bool("force")
timeout := c.Int("timeout")
checksum := os.Getenv("GOPASS_UNCLIP_CHECKSUM")
time.Sleep(time.Second * time.Duration(timeout))
if err := clipboard.Clear(ctx, checksum, force); err != nil {
return ExitError(ctx, ExitIO, e... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Unclip",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"force",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"timeout",
":=",
"c",
".",
"Int",
"(",
... | // Unclip tries to erase the content of the clipboard | [
"Unclip",
"tries",
"to",
"erase",
"the",
"content",
"of",
"the",
"clipboard"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/unclip.go#L14-L24 | train |
gopasspw/gopass | pkg/action/find.go | Find | func (s *Action) Find(ctx context.Context, c *cli.Context) error {
if c.IsSet("clip") {
ctx = WithClip(ctx, c.Bool("clip"))
}
if !c.Args().Present() {
return ExitError(ctx, ExitUsage, nil, "Usage: %s find <NEEDLE>", s.Name)
}
return s.find(ctx, c, c.Args().First(), s.show)
} | go | func (s *Action) Find(ctx context.Context, c *cli.Context) error {
if c.IsSet("clip") {
ctx = WithClip(ctx, c.Bool("clip"))
}
if !c.Args().Present() {
return ExitError(ctx, ExitUsage, nil, "Usage: %s find <NEEDLE>", s.Name)
}
return s.find(ctx, c, c.Args().First(), s.show)
} | [
"func",
"(",
"s",
"*",
"Action",
")",
"Find",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"if",
"c",
".",
"IsSet",
"(",
"\"",
"\"",
")",
"{",
"ctx",
"=",
"WithClip",
"(",
"ctx",
",",
"c",
".... | // Find a string in the secret file's name | [
"Find",
"a",
"string",
"in",
"the",
"secret",
"file",
"s",
"name"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/find.go#L18-L28 | train |
gopasspw/gopass | pkg/action/find.go | findSelection | func (s *Action) findSelection(ctx context.Context, c *cli.Context, choices []string, needle string, cb showFunc) error {
sort.Strings(choices)
act, sel := cui.GetSelection(ctx, "Found secrets - Please select an entry", "<↑/↓> to change the selection, <→> to show, <←> to copy, <s> to sync, <e> to edit, <ESC> to quit"... | go | func (s *Action) findSelection(ctx context.Context, c *cli.Context, choices []string, needle string, cb showFunc) error {
sort.Strings(choices)
act, sel := cui.GetSelection(ctx, "Found secrets - Please select an entry", "<↑/↓> to change the selection, <→> to show, <←> to copy, <s> to sync, <e> to edit, <ESC> to quit"... | [
"func",
"(",
"s",
"*",
"Action",
")",
"findSelection",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
",",
"choices",
"[",
"]",
"string",
",",
"needle",
"string",
",",
"cb",
"showFunc",
")",
"error",
"{",
"sort",
".",
... | // findSelection runs a wizard that lets the user select an entry | [
"findSelection",
"runs",
"a",
"wizard",
"that",
"lets",
"the",
"user",
"select",
"an",
"entry"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/find.go#L75-L105 | train |
gopasspw/gopass | pkg/qrcon/qrcon.go | QRCode | func QRCode(content string) (string, error) {
q, err := qrcode.New(content, qrcode.Medium)
if err != nil {
return "", err
}
buf := bytes.Buffer{}
i := q.Image(0)
b := i.Bounds()
for x := b.Min.X; x < b.Max.X; x++ {
for y := b.Min.Y; y < b.Max.Y; y++ {
col := i.At(x, y)
if sameColor(col, q.ForegroundCol... | go | func QRCode(content string) (string, error) {
q, err := qrcode.New(content, qrcode.Medium)
if err != nil {
return "", err
}
buf := bytes.Buffer{}
i := q.Image(0)
b := i.Bounds()
for x := b.Min.X; x < b.Max.X; x++ {
for y := b.Min.Y; y < b.Max.Y; y++ {
col := i.At(x, y)
if sameColor(col, q.ForegroundCol... | [
"func",
"QRCode",
"(",
"content",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"q",
",",
"err",
":=",
"qrcode",
".",
"New",
"(",
"content",
",",
"qrcode",
".",
"Medium",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"\"",
"\"",
","... | // QRCode returns a string containing an ANSI encoded
// QR Code | [
"QRCode",
"returns",
"a",
"string",
"containing",
"an",
"ANSI",
"encoded",
"QR",
"Code"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/qrcon/qrcon.go#L18-L40 | train |
gopasspw/gopass | pkg/store/root/read.go | GetContext | func (r *Store) GetContext(ctx context.Context, name string) (store.Secret, context.Context, error) {
// forward to substore
ctx, store, name := r.getStore(ctx, name)
sec, err := store.Get(ctx, name)
return sec, ctx, err
} | go | func (r *Store) GetContext(ctx context.Context, name string) (store.Secret, context.Context, error) {
// forward to substore
ctx, store, name := r.getStore(ctx, name)
sec, err := store.Get(ctx, name)
return sec, ctx, err
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GetContext",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"store",
".",
"Secret",
",",
"context",
".",
"Context",
",",
"error",
")",
"{",
"// forward to substore",
"ctx",
",",
"store",
",... | // GetContext returns the plaintext and the context of a single key | [
"GetContext",
"returns",
"the",
"plaintext",
"and",
"the",
"context",
"of",
"a",
"single",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/read.go#L17-L22 | train |
gopasspw/gopass | pkg/tree/simple/tree.go | New | func New(name string) *Folder {
f := newFolder(name)
f.Root = true
return f
} | go | func New(name string) *Folder {
f := newFolder(name)
f.Root = true
return f
} | [
"func",
"New",
"(",
"name",
"string",
")",
"*",
"Folder",
"{",
"f",
":=",
"newFolder",
"(",
"name",
")",
"\n",
"f",
".",
"Root",
"=",
"true",
"\n",
"return",
"f",
"\n",
"}"
] | // New create a new root folder | [
"New",
"create",
"a",
"new",
"root",
"folder"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tree/simple/tree.go#L27-L31 | train |
gopasspw/gopass | pkg/updater/update_others.go | IsUpdateable | func IsUpdateable(ctx context.Context) error {
fn, err := executable(ctx)
if err != nil {
return err
}
out.Debug(ctx, "isUpdateable - File: %s", fn)
// check if this is a test binary
if strings.HasSuffix(filepath.Base(fn), ".test") {
return nil
}
// check if we want to force updateability
if uf := os.Gete... | go | func IsUpdateable(ctx context.Context) error {
fn, err := executable(ctx)
if err != nil {
return err
}
out.Debug(ctx, "isUpdateable - File: %s", fn)
// check if this is a test binary
if strings.HasSuffix(filepath.Base(fn), ".test") {
return nil
}
// check if we want to force updateability
if uf := os.Gete... | [
"func",
"IsUpdateable",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"fn",
",",
"err",
":=",
"executable",
"(",
"ctx",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n",
"out",
".",
"Debug",
"(",
"ctx",
",",
... | // IsUpdateable returns an error if this binary is not updateable | [
"IsUpdateable",
"returns",
"an",
"error",
"if",
"this",
"binary",
"is",
"not",
"updateable"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/updater/update_others.go#L77-L114 | train |
gopasspw/gopass | pkg/config/location.go | Homedir | func Homedir() string {
if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
return hd
}
hd, err := homedir.Dir()
if err != nil {
if debug {
fmt.Printf("[DEBUG] Failed to get homedir: %s\n", err)
}
return ""
}
return hd
} | go | func Homedir() string {
if hd := os.Getenv("GOPASS_HOMEDIR"); hd != "" {
return hd
}
hd, err := homedir.Dir()
if err != nil {
if debug {
fmt.Printf("[DEBUG] Failed to get homedir: %s\n", err)
}
return ""
}
return hd
} | [
"func",
"Homedir",
"(",
")",
"string",
"{",
"if",
"hd",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
";",
"hd",
"!=",
"\"",
"\"",
"{",
"return",
"hd",
"\n",
"}",
"\n",
"hd",
",",
"err",
":=",
"homedir",
".",
"Dir",
"(",
")",
"\n",
"if",
... | // Homedir returns the users home dir or an empty string if the lookup fails | [
"Homedir",
"returns",
"the",
"users",
"home",
"dir",
"or",
"an",
"empty",
"string",
"if",
"the",
"lookup",
"fails"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/location.go#L15-L27 | train |
gopasspw/gopass | pkg/config/location.go | configLocations | func configLocations() []string {
l := []string{}
if cf := os.Getenv("GOPASS_CONFIG"); cf != "" {
l = append(l, cf)
}
if xch := os.Getenv("XDG_CONFIG_HOME"); xch != "" {
l = append(l, filepath.Join(xch, "gopass", "config.yml"))
}
l = append(l, filepath.Join(Homedir(), ".config", "gopass", "config.yml"))
l = ... | go | func configLocations() []string {
l := []string{}
if cf := os.Getenv("GOPASS_CONFIG"); cf != "" {
l = append(l, cf)
}
if xch := os.Getenv("XDG_CONFIG_HOME"); xch != "" {
l = append(l, filepath.Join(xch, "gopass", "config.yml"))
}
l = append(l, filepath.Join(Homedir(), ".config", "gopass", "config.yml"))
l = ... | [
"func",
"configLocations",
"(",
")",
"[",
"]",
"string",
"{",
"l",
":=",
"[",
"]",
"string",
"{",
"}",
"\n",
"if",
"cf",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
";",
"cf",
"!=",
"\"",
"\"",
"{",
"l",
"=",
"append",
"(",
"l",
",",
"... | // configLocations returns the possible locations of gopass config files,
// in decreasing priority | [
"configLocations",
"returns",
"the",
"possible",
"locations",
"of",
"gopass",
"config",
"files",
"in",
"decreasing",
"priority"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/location.go#L49-L60 | train |
gopasspw/gopass | pkg/jsonapi/manifest/wrapper.go | Render | func Render(browser, wrapperPath, binPath string, global bool) ([]byte, []byte, error) {
mf, err := getManifestContent(browser, wrapperPath)
if err != nil {
return nil, nil, err
}
if binPath == "" {
binPath = gopassPath(global)
}
wrap, err := getWrapperContent(binPath)
if err != nil {
return nil, nil, err... | go | func Render(browser, wrapperPath, binPath string, global bool) ([]byte, []byte, error) {
mf, err := getManifestContent(browser, wrapperPath)
if err != nil {
return nil, nil, err
}
if binPath == "" {
binPath = gopassPath(global)
}
wrap, err := getWrapperContent(binPath)
if err != nil {
return nil, nil, err... | [
"func",
"Render",
"(",
"browser",
",",
"wrapperPath",
",",
"binPath",
"string",
",",
"global",
"bool",
")",
"(",
"[",
"]",
"byte",
",",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"mf",
",",
"err",
":=",
"getManifestContent",
"(",
"browser",
",",
"wrap... | // Render returns the rendered wrapper and manifest | [
"Render",
"returns",
"the",
"rendered",
"wrapper",
"and",
"manifest"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/wrapper.go#L31-L46 | train |
gopasspw/gopass | pkg/store/root/git.go | GitInit | func (r *Store) GitInit(ctx context.Context, name, userName, userEmail string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.GitInit(ctx, userName, userEmail)
} | go | func (r *Store) GitInit(ctx context.Context, name, userName, userEmail string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.GitInit(ctx, userName, userEmail)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitInit",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"userName",
",",
"userEmail",
"string",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name",
... | // GitInit initializes the git repo | [
"GitInit",
"initializes",
"the",
"git",
"repo"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L22-L25 | train |
gopasspw/gopass | pkg/store/root/git.go | GitInitConfig | func (r *Store) GitInitConfig(ctx context.Context, name, userName, userEmail string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().InitConfig(ctx, userName, userEmail)
} | go | func (r *Store) GitInitConfig(ctx context.Context, name, userName, userEmail string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().InitConfig(ctx, userName, userEmail)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitInitConfig",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"userName",
",",
"userEmail",
"string",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"n... | // GitInitConfig initializes the git repos local config | [
"GitInitConfig",
"initializes",
"the",
"git",
"repos",
"local",
"config"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L28-L31 | train |
gopasspw/gopass | pkg/store/root/git.go | GitVersion | func (r *Store) GitVersion(ctx context.Context) semver.Version {
return r.store.RCS().Version(ctx)
} | go | func (r *Store) GitVersion(ctx context.Context) semver.Version {
return r.store.RCS().Version(ctx)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitVersion",
"(",
"ctx",
"context",
".",
"Context",
")",
"semver",
".",
"Version",
"{",
"return",
"r",
".",
"store",
".",
"RCS",
"(",
")",
".",
"Version",
"(",
"ctx",
")",
"\n",
"}"
] | // GitVersion returns git version information | [
"GitVersion",
"returns",
"git",
"version",
"information"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L34-L36 | train |
gopasspw/gopass | pkg/store/root/git.go | GitAddRemote | func (r *Store) GitAddRemote(ctx context.Context, name, remote, url string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().AddRemote(ctx, remote, url)
} | go | func (r *Store) GitAddRemote(ctx context.Context, name, remote, url string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().AddRemote(ctx, remote, url)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitAddRemote",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"remote",
",",
"url",
"string",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name",
"... | // GitAddRemote adds a git remote | [
"GitAddRemote",
"adds",
"a",
"git",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L39-L42 | train |
gopasspw/gopass | pkg/store/root/git.go | GitRemoveRemote | func (r *Store) GitRemoveRemote(ctx context.Context, name, remote string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().RemoveRemote(ctx, remote)
} | go | func (r *Store) GitRemoveRemote(ctx context.Context, name, remote string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().RemoveRemote(ctx, remote)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitRemoveRemote",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"remote",
"string",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name",
")",
"\n",
... | // GitRemoveRemote removes a git remote | [
"GitRemoveRemote",
"removes",
"a",
"git",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L45-L48 | train |
gopasspw/gopass | pkg/store/root/git.go | GitPull | func (r *Store) GitPull(ctx context.Context, name, origin, remote string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().Pull(ctx, origin, remote)
} | go | func (r *Store) GitPull(ctx context.Context, name, origin, remote string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().Pull(ctx, origin, remote)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitPull",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"origin",
",",
"remote",
"string",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name",
")"... | // GitPull performs a git pull | [
"GitPull",
"performs",
"a",
"git",
"pull"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L51-L54 | train |
gopasspw/gopass | pkg/store/root/git.go | GitPush | func (r *Store) GitPush(ctx context.Context, name, origin, remote string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().Push(ctx, origin, remote)
} | go | func (r *Store) GitPush(ctx context.Context, name, origin, remote string) error {
ctx, store, _ := r.getStore(ctx, name)
return store.RCS().Push(ctx, origin, remote)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GitPush",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"origin",
",",
"remote",
"string",
")",
"error",
"{",
"ctx",
",",
"store",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name",
")"... | // GitPush performs a git push | [
"GitPush",
"performs",
"a",
"git",
"push"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L57-L60 | train |
gopasspw/gopass | pkg/store/root/git.go | ListRevisions | func (r *Store) ListRevisions(ctx context.Context, name string) ([]backend.Revision, error) {
ctx, store, name := r.getStore(ctx, name)
return store.ListRevisions(ctx, name)
} | go | func (r *Store) ListRevisions(ctx context.Context, name string) ([]backend.Revision, error) {
ctx, store, name := r.getStore(ctx, name)
return store.ListRevisions(ctx, name)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"ListRevisions",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"(",
"[",
"]",
"backend",
".",
"Revision",
",",
"error",
")",
"{",
"ctx",
",",
"store",
",",
"name",
":=",
"r",
".",
"getStore"... | // ListRevisions will list all revisions for the named entity | [
"ListRevisions",
"will",
"list",
"all",
"revisions",
"for",
"the",
"named",
"entity"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L63-L66 | train |
gopasspw/gopass | pkg/store/root/git.go | GetRevision | func (r *Store) GetRevision(ctx context.Context, name, revision string) (store.Secret, error) {
ctx, store, name := r.getStore(ctx, name)
return store.GetRevision(ctx, name, revision)
} | go | func (r *Store) GetRevision(ctx context.Context, name, revision string) (store.Secret, error) {
ctx, store, name := r.getStore(ctx, name)
return store.GetRevision(ctx, name, revision)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"GetRevision",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"revision",
"string",
")",
"(",
"store",
".",
"Secret",
",",
"error",
")",
"{",
"ctx",
",",
"store",
",",
"name",
":=",
"r",
".",
"getStore... | // GetRevision will try to retrieve the given revision from the sync backend | [
"GetRevision",
"will",
"try",
"to",
"retrieve",
"the",
"given",
"revision",
"from",
"the",
"sync",
"backend"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/git.go#L69-L72 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/loader.go | Init | func (l loader) Init(ctx context.Context, path, username, email string) (backend.RCS, error) {
return Init(ctx, path)
} | go | func (l loader) Init(ctx context.Context, path, username, email string) (backend.RCS, error) {
return Init(ctx, path)
} | [
"func",
"(",
"l",
"loader",
")",
"Init",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
",",
"username",
",",
"email",
"string",
")",
"(",
"backend",
".",
"RCS",
",",
"error",
")",
"{",
"return",
"Init",
"(",
"ctx",
",",
"path",
")",
"\n",
"... | // Init implements backend.RCSLoader | [
"Init",
"implements",
"backend",
".",
"RCSLoader"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/loader.go#L32-L34 | train |
gopasspw/gopass | pkg/action/insert.go | Insert | func (s *Action) Insert(ctx context.Context, c *cli.Context) error {
echo := c.Bool("echo")
multiline := c.Bool("multiline")
force := c.Bool("force")
append := c.Bool("append")
args, kvps := parseArgs(c)
name := args.Get(0)
key := args.Get(1)
if name == "" {
return ExitError(ctx, ExitNoName, nil, "Usage: %s... | go | func (s *Action) Insert(ctx context.Context, c *cli.Context) error {
echo := c.Bool("echo")
multiline := c.Bool("multiline")
force := c.Bool("force")
append := c.Bool("append")
args, kvps := parseArgs(c)
name := args.Get(0)
key := args.Get(1)
if name == "" {
return ExitError(ctx, ExitNoName, nil, "Usage: %s... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Insert",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"echo",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"multiline",
":=",
"c",
".",
"Bool",
"("... | // Insert a string as content to a secret file | [
"Insert",
"a",
"string",
"as",
"content",
"to",
"a",
"secret",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/insert.go#L23-L38 | train |
gopasspw/gopass | pkg/config/io.go | Load | func Load() *Config {
for _, l := range configLocations() {
if debug {
fmt.Printf("[DEBUG] Trying to load config from %s\n", l)
}
cfg, err := load(l)
if err == ErrConfigNotFound {
continue
}
if err != nil {
panic(err)
}
_ = cfg.checkDefaults()
if debug {
fmt.Printf("[DEBUG] Loaded config ... | go | func Load() *Config {
for _, l := range configLocations() {
if debug {
fmt.Printf("[DEBUG] Trying to load config from %s\n", l)
}
cfg, err := load(l)
if err == ErrConfigNotFound {
continue
}
if err != nil {
panic(err)
}
_ = cfg.checkDefaults()
if debug {
fmt.Printf("[DEBUG] Loaded config ... | [
"func",
"Load",
"(",
")",
"*",
"Config",
"{",
"for",
"_",
",",
"l",
":=",
"range",
"configLocations",
"(",
")",
"{",
"if",
"debug",
"{",
"fmt",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"l",
")",
"\n",
"}",
"\n",
"cfg",
",",
"err",
":=",
"l... | // Load will try to load the config from one of the default locations | [
"Load",
"will",
"try",
"to",
"load",
"the",
"config",
"from",
"one",
"of",
"the",
"default",
"locations"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/io.go#L17-L42 | train |
gopasspw/gopass | pkg/config/io.go | Save | func (c *Config) Save() error {
if err := c.checkDefaults(); err != nil {
return err
}
buf, err := yaml.Marshal(c)
if err != nil {
return errors.Wrapf(err, "failed to marshal YAML")
}
cfgLoc := configLocation()
cfgDir := filepath.Dir(cfgLoc)
if !fsutil.IsDir(cfgDir) {
if err := os.MkdirAll(cfgDir, 0700)... | go | func (c *Config) Save() error {
if err := c.checkDefaults(); err != nil {
return err
}
buf, err := yaml.Marshal(c)
if err != nil {
return errors.Wrapf(err, "failed to marshal YAML")
}
cfgLoc := configLocation()
cfgDir := filepath.Dir(cfgLoc)
if !fsutil.IsDir(cfgDir) {
if err := os.MkdirAll(cfgDir, 0700)... | [
"func",
"(",
"c",
"*",
"Config",
")",
"Save",
"(",
")",
"error",
"{",
"if",
"err",
":=",
"c",
".",
"checkDefaults",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"err",
"\n",
"}",
"\n\n",
"buf",
",",
"err",
":=",
"yaml",
".",
"Marshal",
"("... | // Save saves the config | [
"Save",
"saves",
"the",
"config"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/io.go#L119-L143 | train |
gopasspw/gopass | pkg/action/delete.go | Delete | func (s *Action) Delete(ctx context.Context, c *cli.Context) error {
force := c.Bool("force")
recursive := c.Bool("recursive")
name := c.Args().First()
if name == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s rm name", s.Name)
}
if !recursive && s.Store.IsDir(ctx, name) {
return ExitError(ctx, ExitU... | go | func (s *Action) Delete(ctx context.Context, c *cli.Context) error {
force := c.Bool("force")
recursive := c.Bool("recursive")
name := c.Args().First()
if name == "" {
return ExitError(ctx, ExitUsage, nil, "Usage: %s rm name", s.Name)
}
if !recursive && s.Store.IsDir(ctx, name) {
return ExitError(ctx, ExitU... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Delete",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"force",
":=",
"c",
".",
"Bool",
"(",
"\"",
"\"",
")",
"\n",
"recursive",
":=",
"c",
".",
"Bool",
"(... | // Delete a secret file with its content | [
"Delete",
"a",
"secret",
"file",
"with",
"its",
"content"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/delete.go#L14-L56 | train |
gopasspw/gopass | pkg/action/delete.go | deleteKeyFromYAML | func (s *Action) deleteKeyFromYAML(ctx context.Context, name, key string) error {
sec, err := s.Store.Get(ctx, name)
if err != nil {
return ExitError(ctx, ExitIO, err, "Can not delete key '%s' from '%s': %s", key, name, err)
}
if err := sec.DeleteKey(key); err != nil {
return ExitError(ctx, ExitIO, err, "Can no... | go | func (s *Action) deleteKeyFromYAML(ctx context.Context, name, key string) error {
sec, err := s.Store.Get(ctx, name)
if err != nil {
return ExitError(ctx, ExitIO, err, "Can not delete key '%s' from '%s': %s", key, name, err)
}
if err := sec.DeleteKey(key); err != nil {
return ExitError(ctx, ExitIO, err, "Can no... | [
"func",
"(",
"s",
"*",
"Action",
")",
"deleteKeyFromYAML",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
",",
"key",
"string",
")",
"error",
"{",
"sec",
",",
"err",
":=",
"s",
".",
"Store",
".",
"Get",
"(",
"ctx",
",",
"name",
")",
"\n",
"i... | // deleteKeyFromYAML deletes a single key from YAML | [
"deleteKeyFromYAML",
"deletes",
"a",
"single",
"key",
"from",
"YAML"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/delete.go#L59-L71 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Open | func Open(path string) (*Git, error) {
r, err := git.PlainOpen(path)
if err != nil {
return nil, err
}
w, err := r.Worktree()
if err != nil {
return nil, err
}
return &Git{
path: path,
repo: r,
wt: w,
}, nil
} | go | func Open(path string) (*Git, error) {
r, err := git.PlainOpen(path)
if err != nil {
return nil, err
}
w, err := r.Worktree()
if err != nil {
return nil, err
}
return &Git{
path: path,
repo: r,
wt: w,
}, nil
} | [
"func",
"Open",
"(",
"path",
"string",
")",
"(",
"*",
"Git",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"git",
".",
"PlainOpen",
"(",
"path",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"w",
"... | // Open tries to open an existing git repo on disk | [
"Open",
"tries",
"to",
"open",
"an",
"existing",
"git",
"repo",
"on",
"disk"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L38-L54 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Clone | func Clone(ctx context.Context, repo, path string) (*Git, error) {
r, err := git.PlainCloneContext(ctx, path, false, &git.CloneOptions{
URL: repo,
Progress: Stdout,
})
if err != nil {
return nil, err
}
w, err := r.Worktree()
if err != nil {
return nil, err
}
return &Git{
path: path,
repo: r,
... | go | func Clone(ctx context.Context, repo, path string) (*Git, error) {
r, err := git.PlainCloneContext(ctx, path, false, &git.CloneOptions{
URL: repo,
Progress: Stdout,
})
if err != nil {
return nil, err
}
w, err := r.Worktree()
if err != nil {
return nil, err
}
return &Git{
path: path,
repo: r,
... | [
"func",
"Clone",
"(",
"ctx",
"context",
".",
"Context",
",",
"repo",
",",
"path",
"string",
")",
"(",
"*",
"Git",
",",
"error",
")",
"{",
"r",
",",
"err",
":=",
"git",
".",
"PlainCloneContext",
"(",
"ctx",
",",
"path",
",",
"false",
",",
"&",
"gi... | // Clone tries to clone an git repo from a remote | [
"Clone",
"tries",
"to",
"clone",
"an",
"git",
"repo",
"from",
"a",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L57-L76 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Init | func Init(ctx context.Context, path string) (*Git, error) {
g := &Git{
path: path,
}
if !g.IsInitialized() {
r, err := git.PlainInit(path, false)
if err != nil {
return nil, errors.Wrapf(err, "Failed to initialize git: %s", err)
}
g.repo = r
wt, err := g.repo.Worktree()
if err != nil {
return ni... | go | func Init(ctx context.Context, path string) (*Git, error) {
g := &Git{
path: path,
}
if !g.IsInitialized() {
r, err := git.PlainInit(path, false)
if err != nil {
return nil, errors.Wrapf(err, "Failed to initialize git: %s", err)
}
g.repo = r
wt, err := g.repo.Worktree()
if err != nil {
return ni... | [
"func",
"Init",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
")",
"(",
"*",
"Git",
",",
"error",
")",
"{",
"g",
":=",
"&",
"Git",
"{",
"path",
":",
"path",
",",
"}",
"\n\n",
"if",
"!",
"g",
".",
"IsInitialized",
"(",
")",
"{",
... | // Init creates a new git repo on disk | [
"Init",
"creates",
"a",
"new",
"git",
"repo",
"on",
"disk"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L79-L117 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | IsInitialized | func (g *Git) IsInitialized() bool {
_, err := git.PlainOpen(g.path)
return err == nil
} | go | func (g *Git) IsInitialized() bool {
_, err := git.PlainOpen(g.path)
return err == nil
} | [
"func",
"(",
"g",
"*",
"Git",
")",
"IsInitialized",
"(",
")",
"bool",
"{",
"_",
",",
"err",
":=",
"git",
".",
"PlainOpen",
"(",
"g",
".",
"path",
")",
"\n",
"return",
"err",
"==",
"nil",
"\n",
"}"
] | // IsInitialized returns true if this is a valid repo | [
"IsInitialized",
"returns",
"true",
"if",
"this",
"is",
"a",
"valid",
"repo"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L128-L131 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Add | func (g *Git) Add(ctx context.Context, files ...string) error {
if len(files) < 1 || (len(files) == 1 && files[0] == g.path) {
return g.addAll()
}
for _, file := range files {
if strings.HasPrefix(file, g.path) {
file = strings.TrimPrefix(file, g.path+string(filepath.Separator))
}
_, err := g.wt.Add(file)... | go | func (g *Git) Add(ctx context.Context, files ...string) error {
if len(files) < 1 || (len(files) == 1 && files[0] == g.path) {
return g.addAll()
}
for _, file := range files {
if strings.HasPrefix(file, g.path) {
file = strings.TrimPrefix(file, g.path+string(filepath.Separator))
}
_, err := g.wt.Add(file)... | [
"func",
"(",
"g",
"*",
"Git",
")",
"Add",
"(",
"ctx",
"context",
".",
"Context",
",",
"files",
"...",
"string",
")",
"error",
"{",
"if",
"len",
"(",
"files",
")",
"<",
"1",
"||",
"(",
"len",
"(",
"files",
")",
"==",
"1",
"&&",
"files",
"[",
"... | // Add adds any number of files to git | [
"Add",
"adds",
"any",
"number",
"of",
"files",
"to",
"git"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L134-L148 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | HasStagedChanges | func (g *Git) HasStagedChanges(ctx context.Context) bool {
st, err := g.wt.Status()
if err != nil {
out.Error(ctx, "Error: Unable to get status: %s", err)
return false
}
return !st.IsClean()
} | go | func (g *Git) HasStagedChanges(ctx context.Context) bool {
st, err := g.wt.Status()
if err != nil {
out.Error(ctx, "Error: Unable to get status: %s", err)
return false
}
return !st.IsClean()
} | [
"func",
"(",
"g",
"*",
"Git",
")",
"HasStagedChanges",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"st",
",",
"err",
":=",
"g",
".",
"wt",
".",
"Status",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"out",
".",
"Error",
"(",
"ctx... | // HasStagedChanges retures true if there are changes which can be committed | [
"HasStagedChanges",
"retures",
"true",
"if",
"there",
"are",
"changes",
"which",
"can",
"be",
"committed"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L182-L189 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Commit | func (g *Git) Commit(ctx context.Context, msg string) error {
if !g.HasStagedChanges(ctx) {
return store.ErrGitNothingToCommit
}
_, err := g.wt.Commit(msg, &git.CommitOptions{
All: true,
Author: &object.Signature{
Name: os.Getenv("GIT_AUTHOR_NAME"),
Email: os.Getenv("GIT_AUTHOR_EMAIL"),
When: time.... | go | func (g *Git) Commit(ctx context.Context, msg string) error {
if !g.HasStagedChanges(ctx) {
return store.ErrGitNothingToCommit
}
_, err := g.wt.Commit(msg, &git.CommitOptions{
All: true,
Author: &object.Signature{
Name: os.Getenv("GIT_AUTHOR_NAME"),
Email: os.Getenv("GIT_AUTHOR_EMAIL"),
When: time.... | [
"func",
"(",
"g",
"*",
"Git",
")",
"Commit",
"(",
"ctx",
"context",
".",
"Context",
",",
"msg",
"string",
")",
"error",
"{",
"if",
"!",
"g",
".",
"HasStagedChanges",
"(",
"ctx",
")",
"{",
"return",
"store",
".",
"ErrGitNothingToCommit",
"\n",
"}",
"\... | // Commit creates a new commit | [
"Commit",
"creates",
"a",
"new",
"commit"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L192-L206 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | PushPull | func (g *Git) PushPull(ctx context.Context, op, remote, branch string) error {
if err := g.Pull(ctx, remote, branch); err != nil {
if op == "pull" {
return err
}
out.Yellow(ctx, "Failed to pull before git push: %s", err)
}
if op == "pull" {
return nil
}
return g.Push(ctx, remote, branch)
} | go | func (g *Git) PushPull(ctx context.Context, op, remote, branch string) error {
if err := g.Pull(ctx, remote, branch); err != nil {
if op == "pull" {
return err
}
out.Yellow(ctx, "Failed to pull before git push: %s", err)
}
if op == "pull" {
return nil
}
return g.Push(ctx, remote, branch)
} | [
"func",
"(",
"g",
"*",
"Git",
")",
"PushPull",
"(",
"ctx",
"context",
".",
"Context",
",",
"op",
",",
"remote",
",",
"branch",
"string",
")",
"error",
"{",
"if",
"err",
":=",
"g",
".",
"Pull",
"(",
"ctx",
",",
"remote",
",",
"branch",
")",
";",
... | // PushPull will first pull from the remote and then push any changes | [
"PushPull",
"will",
"first",
"pull",
"from",
"the",
"remote",
"and",
"then",
"push",
"any",
"changes"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L209-L221 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Pull | func (g *Git) Pull(ctx context.Context, remote, branch string) error {
if !g.IsInitialized() {
return store.ErrGitNotInit
}
if remote == "" {
remote = "origin"
}
if branch == "" {
branch = "master"
}
cfg, err := g.repo.Config()
if err != nil {
return errors.Wrapf(err, "Failed to get git config: %s", e... | go | func (g *Git) Pull(ctx context.Context, remote, branch string) error {
if !g.IsInitialized() {
return store.ErrGitNotInit
}
if remote == "" {
remote = "origin"
}
if branch == "" {
branch = "master"
}
cfg, err := g.repo.Config()
if err != nil {
return errors.Wrapf(err, "Failed to get git config: %s", e... | [
"func",
"(",
"g",
"*",
"Git",
")",
"Pull",
"(",
"ctx",
"context",
".",
"Context",
",",
"remote",
",",
"branch",
"string",
")",
"error",
"{",
"if",
"!",
"g",
".",
"IsInitialized",
"(",
")",
"{",
"return",
"store",
".",
"ErrGitNotInit",
"\n",
"}",
"\... | // Pull will pull any changes | [
"Pull",
"will",
"pull",
"any",
"changes"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L224-L249 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Push | func (g *Git) Push(ctx context.Context, remote, branch string) error {
if !g.IsInitialized() {
return store.ErrGitNotInit
}
if remote == "" {
remote = "origin"
}
cfg, err := g.repo.Config()
if err != nil {
return errors.Wrapf(err, "Failed to get git config: %s", err)
}
if _, found := cfg.Remotes[remote]... | go | func (g *Git) Push(ctx context.Context, remote, branch string) error {
if !g.IsInitialized() {
return store.ErrGitNotInit
}
if remote == "" {
remote = "origin"
}
cfg, err := g.repo.Config()
if err != nil {
return errors.Wrapf(err, "Failed to get git config: %s", err)
}
if _, found := cfg.Remotes[remote]... | [
"func",
"(",
"g",
"*",
"Git",
")",
"Push",
"(",
"ctx",
"context",
".",
"Context",
",",
"remote",
",",
"branch",
"string",
")",
"error",
"{",
"if",
"!",
"g",
".",
"IsInitialized",
"(",
")",
"{",
"return",
"store",
".",
"ErrGitNotInit",
"\n",
"}",
"\... | // Push will push any changes to the remote | [
"Push",
"will",
"push",
"any",
"changes",
"to",
"the",
"remote"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L252-L272 | train |
gopasspw/gopass | pkg/backend/rcs/git/gogit/git.go | Cmd | func (g *Git) Cmd(context.Context, string, ...string) error {
return fmt.Errorf("not supported")
} | go | func (g *Git) Cmd(context.Context, string, ...string) error {
return fmt.Errorf("not supported")
} | [
"func",
"(",
"g",
"*",
"Git",
")",
"Cmd",
"(",
"context",
".",
"Context",
",",
"string",
",",
"...",
"string",
")",
"error",
"{",
"return",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}"
] | // Cmd is not supported and will go away eventually | [
"Cmd",
"is",
"not",
"supported",
"and",
"will",
"go",
"away",
"eventually"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/rcs/git/gogit/git.go#L275-L277 | train |
gopasspw/gopass | pkg/store/root/gpg.go | Crypto | func (r *Store) Crypto(ctx context.Context, name string) backend.Crypto {
_, sub, _ := r.getStore(ctx, name)
if !sub.Valid() {
out.Debug(ctx, "Sub-Store not found for %s. Returning nil crypto backend", name)
return nil
}
return sub.Crypto()
} | go | func (r *Store) Crypto(ctx context.Context, name string) backend.Crypto {
_, sub, _ := r.getStore(ctx, name)
if !sub.Valid() {
out.Debug(ctx, "Sub-Store not found for %s. Returning nil crypto backend", name)
return nil
}
return sub.Crypto()
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"Crypto",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
")",
"backend",
".",
"Crypto",
"{",
"_",
",",
"sub",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"name",
")",
"\n",
"if",
"!... | // Crypto returns the crypto backend | [
"Crypto",
"returns",
"the",
"crypto",
"backend"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/gpg.go#L11-L18 | train |
gopasspw/gopass | pkg/action/audit.go | Audit | func (s *Action) Audit(ctx context.Context, c *cli.Context) error {
filter := c.Args().First()
ctx = s.Store.WithConfig(ctx, filter)
out.Print(ctx, "Auditing passwords for common flaws ...")
t, err := s.Store.Tree(ctx)
if err != nil {
return ExitError(ctx, ExitList, err, "failed to get store tree: %s", err)
}... | go | func (s *Action) Audit(ctx context.Context, c *cli.Context) error {
filter := c.Args().First()
ctx = s.Store.WithConfig(ctx, filter)
out.Print(ctx, "Auditing passwords for common flaws ...")
t, err := s.Store.Tree(ctx)
if err != nil {
return ExitError(ctx, ExitList, err, "failed to get store tree: %s", err)
}... | [
"func",
"(",
"s",
"*",
"Action",
")",
"Audit",
"(",
"ctx",
"context",
".",
"Context",
",",
"c",
"*",
"cli",
".",
"Context",
")",
"error",
"{",
"filter",
":=",
"c",
".",
"Args",
"(",
")",
".",
"First",
"(",
")",
"\n",
"ctx",
"=",
"s",
".",
"St... | // Audit validates passwords against common flaws | [
"Audit",
"validates",
"passwords",
"against",
"common",
"flaws"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/action/audit.go#L13-L38 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/gpg.go | New | func New(ctx context.Context, cfg Config) (*GPG, error) {
// ensure created files don't have group or world perms set
// this setting should be inherited by sub-processes
umask(cfg.Umask)
// make sure GPG_TTY is set (if possible)
if gt := os.Getenv("GPG_TTY"); gt == "" {
if t := tty(); t != "" {
_ = os.Seten... | go | func New(ctx context.Context, cfg Config) (*GPG, error) {
// ensure created files don't have group or world perms set
// this setting should be inherited by sub-processes
umask(cfg.Umask)
// make sure GPG_TTY is set (if possible)
if gt := os.Getenv("GPG_TTY"); gt == "" {
if t := tty(); t != "" {
_ = os.Seten... | [
"func",
"New",
"(",
"ctx",
"context",
".",
"Context",
",",
"cfg",
"Config",
")",
"(",
"*",
"GPG",
",",
"error",
")",
"{",
"// ensure created files don't have group or world perms set",
"// this setting should be inherited by sub-processes",
"umask",
"(",
"cfg",
".",
"... | // New creates a new GPG wrapper | [
"New",
"creates",
"a",
"new",
"GPG",
"wrapper"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/gpg.go#L43-L73 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/gpg.go | RecipientIDs | func (g *GPG) RecipientIDs(ctx context.Context, buf []byte) ([]string, error) {
_ = os.Setenv("LANGUAGE", "C")
recp := make([]string, 0, 5)
args := []string{"--batch", "--list-only", "--list-packets", "--no-default-keyring", "--secret-keyring", "/dev/null"}
cmd := exec.CommandContext(ctx, g.binary, args...)
cmd.S... | go | func (g *GPG) RecipientIDs(ctx context.Context, buf []byte) ([]string, error) {
_ = os.Setenv("LANGUAGE", "C")
recp := make([]string, 0, 5)
args := []string{"--batch", "--list-only", "--list-packets", "--no-default-keyring", "--secret-keyring", "/dev/null"}
cmd := exec.CommandContext(ctx, g.binary, args...)
cmd.S... | [
"func",
"(",
"g",
"*",
"GPG",
")",
"RecipientIDs",
"(",
"ctx",
"context",
".",
"Context",
",",
"buf",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"string",
",",
"error",
")",
"{",
"_",
"=",
"os",
".",
"Setenv",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")"... | // RecipientIDs returns a list of recipient IDs for a given file | [
"RecipientIDs",
"returns",
"a",
"list",
"of",
"recipient",
"IDs",
"for",
"a",
"given",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/gpg.go#L76-L108 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/cli/gpg.go | Decrypt | func (g *GPG) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) {
args := append(g.args, "--decrypt")
cmd := exec.CommandContext(ctx, g.binary, args...)
cmd.Stdin = bytes.NewReader(ciphertext)
cmd.Stderr = os.Stderr
out.Debug(ctx, "gpg.Decrypt: %s %+v", cmd.Path, cmd.Args)
return cmd.Output()
} | go | func (g *GPG) Decrypt(ctx context.Context, ciphertext []byte) ([]byte, error) {
args := append(g.args, "--decrypt")
cmd := exec.CommandContext(ctx, g.binary, args...)
cmd.Stdin = bytes.NewReader(ciphertext)
cmd.Stderr = os.Stderr
out.Debug(ctx, "gpg.Decrypt: %s %+v", cmd.Path, cmd.Args)
return cmd.Output()
} | [
"func",
"(",
"g",
"*",
"GPG",
")",
"Decrypt",
"(",
"ctx",
"context",
".",
"Context",
",",
"ciphertext",
"[",
"]",
"byte",
")",
"(",
"[",
"]",
"byte",
",",
"error",
")",
"{",
"args",
":=",
"append",
"(",
"g",
".",
"args",
",",
"\"",
"\"",
")",
... | // Decrypt will try to decrypt the given file | [
"Decrypt",
"will",
"try",
"to",
"decrypt",
"the",
"given",
"file"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/cli/gpg.go#L137-L145 | train |
gopasspw/gopass | pkg/otp/otp.go | Calculate | func Calculate(ctx context.Context, name string, sec store.Secret) (twofactor.OTP, string, error) {
otpURL := ""
// check body
for _, line := range strings.Split(sec.Body(), "\n") {
if strings.HasPrefix(line, "otpauth://") {
otpURL = line
break
}
}
if otpURL != "" {
return twofactor.FromURL(otpURL)
}
... | go | func Calculate(ctx context.Context, name string, sec store.Secret) (twofactor.OTP, string, error) {
otpURL := ""
// check body
for _, line := range strings.Split(sec.Body(), "\n") {
if strings.HasPrefix(line, "otpauth://") {
otpURL = line
break
}
}
if otpURL != "" {
return twofactor.FromURL(otpURL)
}
... | [
"func",
"Calculate",
"(",
"ctx",
"context",
".",
"Context",
",",
"name",
"string",
",",
"sec",
"store",
".",
"Secret",
")",
"(",
"twofactor",
".",
"OTP",
",",
"string",
",",
"error",
")",
"{",
"otpURL",
":=",
"\"",
"\"",
"\n",
"// check body",
"for",
... | // Calculate will compute a OTP code from a given secret | [
"Calculate",
"will",
"compute",
"a",
"OTP",
"code",
"from",
"a",
"given",
"secret"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/otp/otp.go#L15-L42 | train |
gopasspw/gopass | pkg/otp/otp.go | WriteQRFile | func WriteQRFile(ctx context.Context, otp twofactor.OTP, label, file string) error {
var qr []byte
var err error
switch otp.Type() {
case twofactor.OATH_HOTP:
hotp := otp.(*twofactor.HOTP)
qr, err = hotp.QR(label)
case twofactor.OATH_TOTP:
totp := otp.(*twofactor.TOTP)
qr, err = totp.QR(label)
default:
... | go | func WriteQRFile(ctx context.Context, otp twofactor.OTP, label, file string) error {
var qr []byte
var err error
switch otp.Type() {
case twofactor.OATH_HOTP:
hotp := otp.(*twofactor.HOTP)
qr, err = hotp.QR(label)
case twofactor.OATH_TOTP:
totp := otp.(*twofactor.TOTP)
qr, err = totp.QR(label)
default:
... | [
"func",
"WriteQRFile",
"(",
"ctx",
"context",
".",
"Context",
",",
"otp",
"twofactor",
".",
"OTP",
",",
"label",
",",
"file",
"string",
")",
"error",
"{",
"var",
"qr",
"[",
"]",
"byte",
"\n",
"var",
"err",
"error",
"\n",
"switch",
"otp",
".",
"Type",... | // WriteQRFile writes the given OTP code as a QR image to disk | [
"WriteQRFile",
"writes",
"the",
"given",
"OTP",
"code",
"as",
"a",
"QR",
"image",
"to",
"disk"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/otp/otp.go#L45-L66 | train |
gopasspw/gopass | pkg/store/root/recipients.go | ListRecipients | func (r *Store) ListRecipients(ctx context.Context, store string) []string {
ctx, sub, _ := r.getStore(ctx, store)
return sub.Recipients(ctx)
} | go | func (r *Store) ListRecipients(ctx context.Context, store string) []string {
ctx, sub, _ := r.getStore(ctx, store)
return sub.Recipients(ctx)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"ListRecipients",
"(",
"ctx",
"context",
".",
"Context",
",",
"store",
"string",
")",
"[",
"]",
"string",
"{",
"ctx",
",",
"sub",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"store",
")",
"\n",
"ret... | // ListRecipients lists all recipients for the given store | [
"ListRecipients",
"lists",
"all",
"recipients",
"for",
"the",
"given",
"store"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L18-L21 | train |
gopasspw/gopass | pkg/store/root/recipients.go | RemoveRecipient | func (r *Store) RemoveRecipient(ctx context.Context, store, rec string) error {
ctx, sub, _ := r.getStore(ctx, store)
return sub.RemoveRecipient(ctx, rec)
} | go | func (r *Store) RemoveRecipient(ctx context.Context, store, rec string) error {
ctx, sub, _ := r.getStore(ctx, store)
return sub.RemoveRecipient(ctx, rec)
} | [
"func",
"(",
"r",
"*",
"Store",
")",
"RemoveRecipient",
"(",
"ctx",
"context",
".",
"Context",
",",
"store",
",",
"rec",
"string",
")",
"error",
"{",
"ctx",
",",
"sub",
",",
"_",
":=",
"r",
".",
"getStore",
"(",
"ctx",
",",
"store",
")",
"\n",
"r... | // RemoveRecipient removes a single recipient from the given store | [
"RemoveRecipient",
"removes",
"a",
"single",
"recipient",
"from",
"the",
"given",
"store"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L30-L33 | train |
gopasspw/gopass | pkg/store/root/recipients.go | ImportMissingPublicKeys | func (r *Store) ImportMissingPublicKeys(ctx context.Context) error {
for alias, sub := range r.mounts {
ctx := r.cfg.Mounts[alias].WithContext(ctx)
if err := sub.ImportMissingPublicKeys(ctx); err != nil {
out.Error(ctx, "[%s] Failed to import missing public keys: %s", alias, err)
}
}
return r.store.ImportM... | go | func (r *Store) ImportMissingPublicKeys(ctx context.Context) error {
for alias, sub := range r.mounts {
ctx := r.cfg.Mounts[alias].WithContext(ctx)
if err := sub.ImportMissingPublicKeys(ctx); err != nil {
out.Error(ctx, "[%s] Failed to import missing public keys: %s", alias, err)
}
}
return r.store.ImportM... | [
"func",
"(",
"r",
"*",
"Store",
")",
"ImportMissingPublicKeys",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"for",
"alias",
",",
"sub",
":=",
"range",
"r",
".",
"mounts",
"{",
"ctx",
":=",
"r",
".",
"cfg",
".",
"Mounts",
"[",
"alias",
... | // ImportMissingPublicKeys import missing public keys in any substore | [
"ImportMissingPublicKeys",
"import",
"missing",
"public",
"keys",
"in",
"any",
"substore"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L53-L62 | train |
gopasspw/gopass | pkg/store/root/recipients.go | RecipientsTree | func (r *Store) RecipientsTree(ctx context.Context, pretty bool) (tree.Tree, error) {
root := simple.New("gopass")
for _, recp := range r.store.Recipients(ctx) {
if err := r.addRecipient(ctx, "", root, recp, pretty); err != nil {
color.Yellow("Failed to add recipient to tree %s: %s", recp, err)
}
}
mps := ... | go | func (r *Store) RecipientsTree(ctx context.Context, pretty bool) (tree.Tree, error) {
root := simple.New("gopass")
for _, recp := range r.store.Recipients(ctx) {
if err := r.addRecipient(ctx, "", root, recp, pretty); err != nil {
color.Yellow("Failed to add recipient to tree %s: %s", recp, err)
}
}
mps := ... | [
"func",
"(",
"r",
"*",
"Store",
")",
"RecipientsTree",
"(",
"ctx",
"context",
".",
"Context",
",",
"pretty",
"bool",
")",
"(",
"tree",
".",
"Tree",
",",
"error",
")",
"{",
"root",
":=",
"simple",
".",
"New",
"(",
"\"",
"\"",
")",
"\n\n",
"for",
"... | // RecipientsTree returns a tree view of all stores' recipients | [
"RecipientsTree",
"returns",
"a",
"tree",
"view",
"of",
"all",
"stores",
"recipients"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/root/recipients.go#L78-L105 | train |
gopasspw/gopass | pkg/backend/crypto/gpg/openpgp/utils.go | gpgHome | func gpgHome(ctx context.Context) string {
if gh := os.Getenv("GNUPGHOME"); gh != "" {
return gh
}
hd, err := homedir.Dir()
if err != nil {
out.Debug(ctx, "Failed to get homedir: %s", err)
return ""
}
return filepath.Join(hd, ".gnupg")
} | go | func gpgHome(ctx context.Context) string {
if gh := os.Getenv("GNUPGHOME"); gh != "" {
return gh
}
hd, err := homedir.Dir()
if err != nil {
out.Debug(ctx, "Failed to get homedir: %s", err)
return ""
}
return filepath.Join(hd, ".gnupg")
} | [
"func",
"gpgHome",
"(",
"ctx",
"context",
".",
"Context",
")",
"string",
"{",
"if",
"gh",
":=",
"os",
".",
"Getenv",
"(",
"\"",
"\"",
")",
";",
"gh",
"!=",
"\"",
"\"",
"{",
"return",
"gh",
"\n",
"}",
"\n",
"hd",
",",
"err",
":=",
"homedir",
"."... | // gpgHome returns the gnupg homedir | [
"gpgHome",
"returns",
"the",
"gnupg",
"homedir"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/backend/crypto/gpg/openpgp/utils.go#L115-L125 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithFsckCheck | func WithFsckCheck(ctx context.Context, check bool) context.Context {
return context.WithValue(ctx, ctxKeyFsckCheck, check)
} | go | func WithFsckCheck(ctx context.Context, check bool) context.Context {
return context.WithValue(ctx, ctxKeyFsckCheck, check)
} | [
"func",
"WithFsckCheck",
"(",
"ctx",
"context",
".",
"Context",
",",
"check",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyFsckCheck",
",",
"check",
")",
"\n",
"}"
] | // WithFsckCheck returns a context with the flag for fscks check set | [
"WithFsckCheck",
"returns",
"a",
"context",
"with",
"the",
"flag",
"for",
"fscks",
"check",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L23-L25 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasFsckCheck | func HasFsckCheck(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyFsckCheck).(bool)
return ok
} | go | func HasFsckCheck(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyFsckCheck).(bool)
return ok
} | [
"func",
"HasFsckCheck",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyFsckCheck",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasFsckCheck returns true if a value for fsck check has been set in this
// context | [
"HasFsckCheck",
"returns",
"true",
"if",
"a",
"value",
"for",
"fsck",
"check",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L29-L32 | train |
gopasspw/gopass | pkg/store/sub/context.go | IsFsckCheck | func IsFsckCheck(ctx context.Context) bool {
bv, ok := ctx.Value(ctxKeyFsckCheck).(bool)
if !ok {
return false
}
return bv
} | go | func IsFsckCheck(ctx context.Context) bool {
bv, ok := ctx.Value(ctxKeyFsckCheck).(bool)
if !ok {
return false
}
return bv
} | [
"func",
"IsFsckCheck",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"bv",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyFsckCheck",
")",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return"... | // IsFsckCheck returns the value of fsck check | [
"IsFsckCheck",
"returns",
"the",
"value",
"of",
"fsck",
"check"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L35-L41 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithFsckForce | func WithFsckForce(ctx context.Context, force bool) context.Context {
return context.WithValue(ctx, ctxKeyFsckForce, force)
} | go | func WithFsckForce(ctx context.Context, force bool) context.Context {
return context.WithValue(ctx, ctxKeyFsckForce, force)
} | [
"func",
"WithFsckForce",
"(",
"ctx",
"context",
".",
"Context",
",",
"force",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyFsckForce",
",",
"force",
")",
"\n",
"}"
] | // WithFsckForce returns a context with the flag for fsck force set | [
"WithFsckForce",
"returns",
"a",
"context",
"with",
"the",
"flag",
"for",
"fsck",
"force",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L44-L46 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasFsckForce | func HasFsckForce(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyFsckForce).(bool)
return ok
} | go | func HasFsckForce(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyFsckForce).(bool)
return ok
} | [
"func",
"HasFsckForce",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyFsckForce",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasFsckForce returns true if a value for fsck force has been set in this
// context | [
"HasFsckForce",
"returns",
"true",
"if",
"a",
"value",
"for",
"fsck",
"force",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L50-L53 | train |
gopasspw/gopass | pkg/store/sub/context.go | IsFsckForce | func IsFsckForce(ctx context.Context) bool {
bv, ok := ctx.Value(ctxKeyFsckForce).(bool)
if !ok {
return false
}
return bv
} | go | func IsFsckForce(ctx context.Context) bool {
bv, ok := ctx.Value(ctxKeyFsckForce).(bool)
if !ok {
return false
}
return bv
} | [
"func",
"IsFsckForce",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"bv",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyFsckForce",
")",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"false",
"\n",
"}",
"\n",
"return"... | // IsFsckForce returns the value of fsck force | [
"IsFsckForce",
"returns",
"the",
"value",
"of",
"fsck",
"force"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L56-L62 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithAutoSync | func WithAutoSync(ctx context.Context, sync bool) context.Context {
return context.WithValue(ctx, ctxKeyAutoSync, sync)
} | go | func WithAutoSync(ctx context.Context, sync bool) context.Context {
return context.WithValue(ctx, ctxKeyAutoSync, sync)
} | [
"func",
"WithAutoSync",
"(",
"ctx",
"context",
".",
"Context",
",",
"sync",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyAutoSync",
",",
"sync",
")",
"\n",
"}"
] | // WithAutoSync returns a context with the flag for autosync set | [
"WithAutoSync",
"returns",
"a",
"context",
"with",
"the",
"flag",
"for",
"autosync",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L65-L67 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasAutoSync | func HasAutoSync(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyAutoSync).(bool)
return ok
} | go | func HasAutoSync(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyAutoSync).(bool)
return ok
} | [
"func",
"HasAutoSync",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyAutoSync",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasAutoSync has been set if a value for auto sync has been set in this
// context | [
"HasAutoSync",
"has",
"been",
"set",
"if",
"a",
"value",
"for",
"auto",
"sync",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L71-L74 | train |
gopasspw/gopass | pkg/store/sub/context.go | IsAutoSync | func IsAutoSync(ctx context.Context) bool {
bv, ok := ctx.Value(ctxKeyAutoSync).(bool)
if !ok {
return true
}
return bv
} | go | func IsAutoSync(ctx context.Context) bool {
bv, ok := ctx.Value(ctxKeyAutoSync).(bool)
if !ok {
return true
}
return bv
} | [
"func",
"IsAutoSync",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"bv",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyAutoSync",
")",
".",
"(",
"bool",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"true",
"\n",
"}",
"\n",
"return",
... | // IsAutoSync returns the value of autosync | [
"IsAutoSync",
"returns",
"the",
"value",
"of",
"autosync"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L77-L83 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasReason | func HasReason(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyReason).(string)
return ok
} | go | func HasReason(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyReason).(string)
return ok
} | [
"func",
"HasReason",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyReason",
")",
".",
"(",
"string",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasReason returns true if a value for reason has been set in this context | [
"HasReason",
"returns",
"true",
"if",
"a",
"value",
"for",
"reason",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L91-L94 | train |
gopasspw/gopass | pkg/store/sub/context.go | GetReason | func GetReason(ctx context.Context) string {
sv, ok := ctx.Value(ctxKeyReason).(string)
if !ok {
return ""
}
return sv
} | go | func GetReason(ctx context.Context) string {
sv, ok := ctx.Value(ctxKeyReason).(string)
if !ok {
return ""
}
return sv
} | [
"func",
"GetReason",
"(",
"ctx",
"context",
".",
"Context",
")",
"string",
"{",
"sv",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyReason",
")",
".",
"(",
"string",
")",
"\n",
"if",
"!",
"ok",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"ret... | // GetReason returns the value of reason | [
"GetReason",
"returns",
"the",
"value",
"of",
"reason"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L97-L103 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithImportFunc | func WithImportFunc(ctx context.Context, imf store.ImportCallback) context.Context {
return context.WithValue(ctx, ctxKeyImportFunc, imf)
} | go | func WithImportFunc(ctx context.Context, imf store.ImportCallback) context.Context {
return context.WithValue(ctx, ctxKeyImportFunc, imf)
} | [
"func",
"WithImportFunc",
"(",
"ctx",
"context",
".",
"Context",
",",
"imf",
"store",
".",
"ImportCallback",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyImportFunc",
",",
"imf",
")",
"\n",
"}"
] | // WithImportFunc will return a context with the import callback set | [
"WithImportFunc",
"will",
"return",
"a",
"context",
"with",
"the",
"import",
"callback",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L106-L108 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasImportFunc | func HasImportFunc(ctx context.Context) bool {
imf, ok := ctx.Value(ctxKeyImportFunc).(store.ImportCallback)
return ok && imf != nil
} | go | func HasImportFunc(ctx context.Context) bool {
imf, ok := ctx.Value(ctxKeyImportFunc).(store.ImportCallback)
return ok && imf != nil
} | [
"func",
"HasImportFunc",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"imf",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyImportFunc",
")",
".",
"(",
"store",
".",
"ImportCallback",
")",
"\n",
"return",
"ok",
"&&",
"imf",
"!=",
"nil",
... | // HasImportFunc returns true if a value for import func has been set in this
// context | [
"HasImportFunc",
"returns",
"true",
"if",
"a",
"value",
"for",
"import",
"func",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L112-L115 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithRecipientFunc | func WithRecipientFunc(ctx context.Context, imf store.RecipientCallback) context.Context {
return context.WithValue(ctx, ctxKeyRecipientFunc, imf)
} | go | func WithRecipientFunc(ctx context.Context, imf store.RecipientCallback) context.Context {
return context.WithValue(ctx, ctxKeyRecipientFunc, imf)
} | [
"func",
"WithRecipientFunc",
"(",
"ctx",
"context",
".",
"Context",
",",
"imf",
"store",
".",
"RecipientCallback",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyRecipientFunc",
",",
"imf",
")",
"\n",
"}"
... | // WithRecipientFunc will return a context with the recipient callback set | [
"WithRecipientFunc",
"will",
"return",
"a",
"context",
"with",
"the",
"recipient",
"callback",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L130-L132 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasRecipientFunc | func HasRecipientFunc(ctx context.Context) bool {
imf, ok := ctx.Value(ctxKeyRecipientFunc).(store.RecipientCallback)
return ok && imf != nil
} | go | func HasRecipientFunc(ctx context.Context) bool {
imf, ok := ctx.Value(ctxKeyRecipientFunc).(store.RecipientCallback)
return ok && imf != nil
} | [
"func",
"HasRecipientFunc",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"imf",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyRecipientFunc",
")",
".",
"(",
"store",
".",
"RecipientCallback",
")",
"\n",
"return",
"ok",
"&&",
"imf",
"!=",
... | // HasRecipientFunc returns true if a recipient func has been set in this
// context | [
"HasRecipientFunc",
"returns",
"true",
"if",
"a",
"recipient",
"func",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L136-L139 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithFsckFunc | func WithFsckFunc(ctx context.Context, imf store.FsckCallback) context.Context {
return context.WithValue(ctx, ctxKeyFsckFunc, imf)
} | go | func WithFsckFunc(ctx context.Context, imf store.FsckCallback) context.Context {
return context.WithValue(ctx, ctxKeyFsckFunc, imf)
} | [
"func",
"WithFsckFunc",
"(",
"ctx",
"context",
".",
"Context",
",",
"imf",
"store",
".",
"FsckCallback",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyFsckFunc",
",",
"imf",
")",
"\n",
"}"
] | // WithFsckFunc will return a context with the fsck confirmation callback set | [
"WithFsckFunc",
"will",
"return",
"a",
"context",
"with",
"the",
"fsck",
"confirmation",
"callback",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L155-L157 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasFsckFunc | func HasFsckFunc(ctx context.Context) bool {
imf, ok := ctx.Value(ctxKeyFsckFunc).(store.FsckCallback)
return ok && imf != nil
} | go | func HasFsckFunc(ctx context.Context) bool {
imf, ok := ctx.Value(ctxKeyFsckFunc).(store.FsckCallback)
return ok && imf != nil
} | [
"func",
"HasFsckFunc",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"imf",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyFsckFunc",
")",
".",
"(",
"store",
".",
"FsckCallback",
")",
"\n",
"return",
"ok",
"&&",
"imf",
"!=",
"nil",
"\n"... | // HasFsckFunc returns true if a fsck func has been set in this context | [
"HasFsckFunc",
"returns",
"true",
"if",
"a",
"fsck",
"func",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L160-L163 | train |
gopasspw/gopass | pkg/store/sub/context.go | WithCheckRecipients | func WithCheckRecipients(ctx context.Context, cr bool) context.Context {
return context.WithValue(ctx, ctxKeyCheckRecipients, cr)
} | go | func WithCheckRecipients(ctx context.Context, cr bool) context.Context {
return context.WithValue(ctx, ctxKeyCheckRecipients, cr)
} | [
"func",
"WithCheckRecipients",
"(",
"ctx",
"context",
".",
"Context",
",",
"cr",
"bool",
")",
"context",
".",
"Context",
"{",
"return",
"context",
".",
"WithValue",
"(",
"ctx",
",",
"ctxKeyCheckRecipients",
",",
"cr",
")",
"\n",
"}"
] | // WithCheckRecipients will return a context with the flag for check recipients
// set | [
"WithCheckRecipients",
"will",
"return",
"a",
"context",
"with",
"the",
"flag",
"for",
"check",
"recipients",
"set"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L180-L182 | train |
gopasspw/gopass | pkg/store/sub/context.go | HasCheckRecipients | func HasCheckRecipients(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyCheckRecipients).(bool)
return ok
} | go | func HasCheckRecipients(ctx context.Context) bool {
_, ok := ctx.Value(ctxKeyCheckRecipients).(bool)
return ok
} | [
"func",
"HasCheckRecipients",
"(",
"ctx",
"context",
".",
"Context",
")",
"bool",
"{",
"_",
",",
"ok",
":=",
"ctx",
".",
"Value",
"(",
"ctxKeyCheckRecipients",
")",
".",
"(",
"bool",
")",
"\n",
"return",
"ok",
"\n",
"}"
] | // HasCheckRecipients returns true if check recipients has been set in this
// context | [
"HasCheckRecipients",
"returns",
"true",
"if",
"check",
"recipients",
"has",
"been",
"set",
"in",
"this",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/context.go#L186-L189 | train |
gopasspw/gopass | pkg/tempfile/file.go | New | func New(ctx context.Context, prefix string) (*File, error) {
td, err := ioutil.TempDir(tempdirBase(), prefix)
if err != nil {
return nil, err
}
tf := &File{
dir: td,
dbg: ctxutil.IsDebug(ctx),
}
if err := tf.mount(ctx); err != nil {
_ = os.RemoveAll(tf.dir)
return nil, err
}
fn := filepath.Join(tf... | go | func New(ctx context.Context, prefix string) (*File, error) {
td, err := ioutil.TempDir(tempdirBase(), prefix)
if err != nil {
return nil, err
}
tf := &File{
dir: td,
dbg: ctxutil.IsDebug(ctx),
}
if err := tf.mount(ctx); err != nil {
_ = os.RemoveAll(tf.dir)
return nil, err
}
fn := filepath.Join(tf... | [
"func",
"New",
"(",
"ctx",
"context",
".",
"Context",
",",
"prefix",
"string",
")",
"(",
"*",
"File",
",",
"error",
")",
"{",
"td",
",",
"err",
":=",
"ioutil",
".",
"TempDir",
"(",
"tempdirBase",
"(",
")",
",",
"prefix",
")",
"\n",
"if",
"err",
"... | // New returns a new tempfile wrapper | [
"New",
"returns",
"a",
"new",
"tempfile",
"wrapper"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L23-L47 | train |
gopasspw/gopass | pkg/tempfile/file.go | Name | func (t *File) Name() string {
if t.fh == nil {
return ""
}
return t.fh.Name()
} | go | func (t *File) Name() string {
if t.fh == nil {
return ""
}
return t.fh.Name()
} | [
"func",
"(",
"t",
"*",
"File",
")",
"Name",
"(",
")",
"string",
"{",
"if",
"t",
".",
"fh",
"==",
"nil",
"{",
"return",
"\"",
"\"",
"\n",
"}",
"\n",
"return",
"t",
".",
"fh",
".",
"Name",
"(",
")",
"\n",
"}"
] | // Name returns the name of the tempfile | [
"Name",
"returns",
"the",
"name",
"of",
"the",
"tempfile"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L50-L55 | train |
gopasspw/gopass | pkg/tempfile/file.go | Write | func (t *File) Write(p []byte) (int, error) {
if t.fh == nil {
return 0, errors.Errorf("not initialized")
}
return t.fh.Write(p)
} | go | func (t *File) Write(p []byte) (int, error) {
if t.fh == nil {
return 0, errors.Errorf("not initialized")
}
return t.fh.Write(p)
} | [
"func",
"(",
"t",
"*",
"File",
")",
"Write",
"(",
"p",
"[",
"]",
"byte",
")",
"(",
"int",
",",
"error",
")",
"{",
"if",
"t",
".",
"fh",
"==",
"nil",
"{",
"return",
"0",
",",
"errors",
".",
"Errorf",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n",
... | // Write implement io.Writer | [
"Write",
"implement",
"io",
".",
"Writer"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L58-L63 | train |
gopasspw/gopass | pkg/tempfile/file.go | Close | func (t *File) Close() error {
if t.fh == nil {
return nil
}
return t.fh.Close()
} | go | func (t *File) Close() error {
if t.fh == nil {
return nil
}
return t.fh.Close()
} | [
"func",
"(",
"t",
"*",
"File",
")",
"Close",
"(",
")",
"error",
"{",
"if",
"t",
".",
"fh",
"==",
"nil",
"{",
"return",
"nil",
"\n",
"}",
"\n",
"return",
"t",
".",
"fh",
".",
"Close",
"(",
")",
"\n",
"}"
] | // Close implements io.WriteCloser | [
"Close",
"implements",
"io",
".",
"WriteCloser"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L66-L71 | train |
gopasspw/gopass | pkg/tempfile/file.go | Remove | func (t *File) Remove(ctx context.Context) error {
_ = t.Close()
if err := t.unmount(ctx); err != nil {
return errors.Errorf("Failed to unmount %s from %s: %s", t.dev, t.dir, err)
}
if t.dir == "" {
return nil
}
return os.RemoveAll(t.dir)
} | go | func (t *File) Remove(ctx context.Context) error {
_ = t.Close()
if err := t.unmount(ctx); err != nil {
return errors.Errorf("Failed to unmount %s from %s: %s", t.dev, t.dir, err)
}
if t.dir == "" {
return nil
}
return os.RemoveAll(t.dir)
} | [
"func",
"(",
"t",
"*",
"File",
")",
"Remove",
"(",
"ctx",
"context",
".",
"Context",
")",
"error",
"{",
"_",
"=",
"t",
".",
"Close",
"(",
")",
"\n",
"if",
"err",
":=",
"t",
".",
"unmount",
"(",
"ctx",
")",
";",
"err",
"!=",
"nil",
"{",
"retur... | // Remove attempts to remove the tempfile | [
"Remove",
"attempts",
"to",
"remove",
"the",
"tempfile"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/tempfile/file.go#L74-L83 | train |
gopasspw/gopass | pkg/jsonapi/manifest/setup_windows.go | GetRegistryPath | func GetRegistryPath(browser string) (string, error) {
path, found := registryPaths[browser]
if !found {
return "", fmt.Errorf("browser %s on %s is currently not supported", browser, runtime.GOOS)
}
return path, nil
} | go | func GetRegistryPath(browser string) (string, error) {
path, found := registryPaths[browser]
if !found {
return "", fmt.Errorf("browser %s on %s is currently not supported", browser, runtime.GOOS)
}
return path, nil
} | [
"func",
"GetRegistryPath",
"(",
"browser",
"string",
")",
"(",
"string",
",",
"error",
")",
"{",
"path",
",",
"found",
":=",
"registryPaths",
"[",
"browser",
"]",
"\n",
"if",
"!",
"found",
"{",
"return",
"\"",
"\"",
",",
"fmt",
".",
"Errorf",
"(",
"\... | // GetRegistryPath returns the relative registry path to use in the windows registry key | [
"GetRegistryPath",
"returns",
"the",
"relative",
"registry",
"path",
"to",
"use",
"in",
"the",
"windows",
"registry",
"key"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_windows.go#L40-L46 | train |
gopasspw/gopass | pkg/store/sub/fsck.go | Fsck | func (s *Store) Fsck(ctx context.Context, path string) error {
ctx = out.AddPrefix(ctx, "["+s.alias+"] ")
out.Debug(ctx, "Fsck(%s)", path)
// first let the storage backend check itself
if err := s.storage.Fsck(ctx); err != nil {
return errors.Wrapf(err, "storage backend found errors: %s", err)
}
pcb := ctxuti... | go | func (s *Store) Fsck(ctx context.Context, path string) error {
ctx = out.AddPrefix(ctx, "["+s.alias+"] ")
out.Debug(ctx, "Fsck(%s)", path)
// first let the storage backend check itself
if err := s.storage.Fsck(ctx); err != nil {
return errors.Wrapf(err, "storage backend found errors: %s", err)
}
pcb := ctxuti... | [
"func",
"(",
"s",
"*",
"Store",
")",
"Fsck",
"(",
"ctx",
"context",
".",
"Context",
",",
"path",
"string",
")",
"error",
"{",
"ctx",
"=",
"out",
".",
"AddPrefix",
"(",
"ctx",
",",
"\"",
"\"",
"+",
"s",
".",
"alias",
"+",
"\"",
"\"",
")",
"\n",
... | // Fsck checks all entries matching the given prefix | [
"Fsck",
"checks",
"all",
"entries",
"matching",
"the",
"given",
"prefix"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/store/sub/fsck.go#L15-L45 | train |
gopasspw/gopass | pkg/config/context.go | WithContext | func (c StoreConfig) WithContext(ctx context.Context) context.Context {
if !ctxutil.HasAskForMore(ctx) {
ctx = ctxutil.WithAskForMore(ctx, c.AskForMore)
}
if !ctxutil.HasAutoClip(ctx) {
ctx = ctxutil.WithAutoClip(ctx, c.AutoClip)
}
if !c.AutoImport {
ctx = sub.WithImportFunc(ctx, nil)
}
if !sub.HasAutoSync... | go | func (c StoreConfig) WithContext(ctx context.Context) context.Context {
if !ctxutil.HasAskForMore(ctx) {
ctx = ctxutil.WithAskForMore(ctx, c.AskForMore)
}
if !ctxutil.HasAutoClip(ctx) {
ctx = ctxutil.WithAutoClip(ctx, c.AutoClip)
}
if !c.AutoImport {
ctx = sub.WithImportFunc(ctx, nil)
}
if !sub.HasAutoSync... | [
"func",
"(",
"c",
"StoreConfig",
")",
"WithContext",
"(",
"ctx",
"context",
".",
"Context",
")",
"context",
".",
"Context",
"{",
"if",
"!",
"ctxutil",
".",
"HasAskForMore",
"(",
"ctx",
")",
"{",
"ctx",
"=",
"ctxutil",
".",
"WithAskForMore",
"(",
"ctx",
... | // WithContext returns a context with all config options set for this store
// config, iff they have not been already set in the context | [
"WithContext",
"returns",
"a",
"context",
"with",
"all",
"config",
"options",
"set",
"for",
"this",
"store",
"config",
"iff",
"they",
"have",
"not",
"been",
"already",
"set",
"in",
"the",
"context"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/config/context.go#L12-L47 | train |
gopasspw/gopass | pkg/jsonapi/manifest/setup_others.go | ValidBrowser | func ValidBrowser(name string) bool {
_, found := manifestPath[runtime.GOOS][name]
return found
} | go | func ValidBrowser(name string) bool {
_, found := manifestPath[runtime.GOOS][name]
return found
} | [
"func",
"ValidBrowser",
"(",
"name",
"string",
")",
"bool",
"{",
"_",
",",
"found",
":=",
"manifestPath",
"[",
"runtime",
".",
"GOOS",
"]",
"[",
"name",
"]",
"\n",
"return",
"found",
"\n",
"}"
] | // ValidBrowser returns true if the given browser is supported on this platform | [
"ValidBrowser",
"returns",
"true",
"if",
"the",
"given",
"browser",
"is",
"supported",
"on",
"this",
"platform"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_others.go#L46-L49 | train |
gopasspw/gopass | pkg/jsonapi/manifest/setup_others.go | Path | func Path(browser, libpath string, globalInstall bool) (string, error) {
location, err := getLocation(browser, libpath, globalInstall)
if err != nil {
return "", err
}
expanded, err := homedir.Expand(location)
if err != nil {
return "", err
}
return filepath.Join(expanded, Name+".json"), nil
} | go | func Path(browser, libpath string, globalInstall bool) (string, error) {
location, err := getLocation(browser, libpath, globalInstall)
if err != nil {
return "", err
}
expanded, err := homedir.Expand(location)
if err != nil {
return "", err
}
return filepath.Join(expanded, Name+".json"), nil
} | [
"func",
"Path",
"(",
"browser",
",",
"libpath",
"string",
",",
"globalInstall",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"location",
",",
"err",
":=",
"getLocation",
"(",
"browser",
",",
"libpath",
",",
"globalInstall",
")",
"\n",
"if",
"err",... | // Path returns the manifest file path | [
"Path",
"returns",
"the",
"manifest",
"file",
"path"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_others.go#L62-L74 | train |
gopasspw/gopass | pkg/jsonapi/manifest/setup_others.go | getLocation | func getLocation(browser, libpath string, globalInstall bool) (string, error) {
if globalInstall {
return getGlobalLocation(browser, libpath)
}
pm, found := manifestPath[runtime.GOOS]
if !found {
return "", fmt.Errorf("platform %s is currently not supported", runtime.GOOS)
}
path, found := pm[browser]
if !f... | go | func getLocation(browser, libpath string, globalInstall bool) (string, error) {
if globalInstall {
return getGlobalLocation(browser, libpath)
}
pm, found := manifestPath[runtime.GOOS]
if !found {
return "", fmt.Errorf("platform %s is currently not supported", runtime.GOOS)
}
path, found := pm[browser]
if !f... | [
"func",
"getLocation",
"(",
"browser",
",",
"libpath",
"string",
",",
"globalInstall",
"bool",
")",
"(",
"string",
",",
"error",
")",
"{",
"if",
"globalInstall",
"{",
"return",
"getGlobalLocation",
"(",
"browser",
",",
"libpath",
")",
"\n",
"}",
"\n\n",
"p... | // getLocation returns only the manifest path | [
"getLocation",
"returns",
"only",
"the",
"manifest",
"path"
] | fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4 | https://github.com/gopasspw/gopass/blob/fe4e21d62182f0f2e4ef9a0ca8168d849dc52bd4/pkg/jsonapi/manifest/setup_others.go#L77-L91 | train |
Subsets and Splits
SQL Console for semeru/code-text-go
Retrieves a limited set of code samples with their languages, with a specific case adjustment for 'Go' language.