Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add edit.auto-create option #2538

Merged
merged 1 commit into from
Feb 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ This is a list of available options:
| `create.pre-hook` | `string` | This hook is executed right before the secret creation during `gopass create`. | `None` |
| `delete.post-hook` | `string` | This hook is run right after removing a record with `gopass rm` | `None` |
| `domain-alias.<from>.insteadOf` | `string` | Alias from domain to the string value of this entry. | `` |
| `edit.auto-create` | `bool` | Automatically create new secrets when editing. | `false` |
| `edit.editor` | `string` | This setting controls which editor is used when opening a file with `gopass edit`. It takes precedence over the `$EDITOR` environment variable. This setting can contain flags. | `None` |
| `edit.post-hook` | `string` | This hook is run right after editing a record with `gopass edit` |
| `edit.pre-hook` | `string` | This hook is run right before editing a record with `gopass edit` |
Expand Down
3 changes: 2 additions & 1 deletion internal/action/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"github.com/gopasspw/gopass/internal/action/exit"
"github.com/gopasspw/gopass/internal/audit"
"github.com/gopasspw/gopass/internal/config"
"github.com/gopasspw/gopass/internal/editor"
"github.com/gopasspw/gopass/internal/hook"
"github.com/gopasspw/gopass/internal/out"
Expand Down Expand Up @@ -86,7 +87,7 @@ func (s *Action) editUpdate(ctx context.Context, name string, content, nContent
}

func (s *Action) editGetContent(ctx context.Context, name string, create bool) (string, []byte, bool, error) {
if !s.Store.Exists(ctx, name) && !create {
if !s.Store.Exists(ctx, name) && !create && !config.Bool(ctx, "edit.auto-create") {
var err error
name, err = s.editFindName(ctx, name)
if err != nil {
Expand Down