Skip to content

Commit

Permalink
Document delete, env, find and others (#1533)
Browse files Browse the repository at this point in the history
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <[email protected]>
  • Loading branch information
dominikschulz authored Aug 17, 2020
1 parent 9d8313a commit dc65f6e
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 8 deletions.
31 changes: 31 additions & 0 deletions docs/commands/delete.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# `delete` command

The `delete` command is used to remove a single secret or a whole subtree.

Note: Recursive operations crossing mount points are intentionally not supported.

## Synopsis

```
$ gopass delete entry
$ gopass rm -r path/to/folder
$ gopass rm -f entry
$ gopass delete entry key
```

## Modes of operation

* Delete a single secret
* Delete a single key from an existing secret
* Delete a directoy of secrets

## Flags

Flag | Aliases | Description
---- | ------- | -----------
`--recursive``-r` | Recursively delete files and folders.
`--force` | `-f` | Do not ask for confirmation.

## Details

* Removing a single key will need to decrypt the secret
12 changes: 12 additions & 0 deletions docs/commands/env.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# `env` command

The `env` command runs a binary as a subprocess with a pre-populated environment.
The environment of the subprocess is populated with a set of environment variables corresponding
to the secret subtree specified on the command line.

## Synopsis

```
$ gopass env entry env
```

23 changes: 23 additions & 0 deletions docs/commands/find.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# `find` command

The `find` command will attempt to do a simple substring match on the names of all secrets.
If there is a single match it will directly invoke `show` and display the result.
If there are multiple matches a selection will be shown.

Note: The find command will not fall back to a fuzzy search.

## Synopsis

```
$ gopass find entry
$ gopass find -f entry
$ gopass find -c entry
```

## Flags

Flag | Aliases | Description
---- | ------- | -----------
`--clip` | `-c` | Copy the password into the clipboard.
`--unsafe` | `-u` | Display any unsafe content, even if `safecontent` is enabled.

2 changes: 1 addition & 1 deletion docs/commands/insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $ gopass insert entry
$ gopass insert entry key
```

## Modes of operations
## Modes of operation

* Create a new entry with a user-supplied password, e.g. a new site with a user-generated password or one picked from `gopass pwgen`: `gopass insert entry`
* Change an existing entry to a user-supplied password
Expand Down
39 changes: 39 additions & 0 deletions docs/commands/move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# `move` command

Note: The implementations for `copy` and `move` are exactly the same. The only difference is that `move` will remove the source after a successful copy.

The `move` command works like the Unix `mv` or `rsync` binaries. It allows moving either single entries or whole folders around. Moving across mounts is supported.

If the source is a directory, the source directory is re-created at the destination if no trailing slash is found. Otherwise the contained secrets are placed into the destination directory (similar to what `rsync` does).

Please note that `move` will always decrypt the source and re-encrypt at the destination.

Moving a secret onto itself is a no-op.

## Synopsis

```
# Overwrite new/leaf
$ gopass move path/to/leaf new/leaf
# Move the content of path/to/somedir to new/dir/somedir
$ gopass move path/to/somedirdir new/dir
# Does nothing
$ gopass move entry entry
```

## Modes of operation

* Move a single secret from source to destination
* Move a folder of secrets, possibly with sub folders, from source to destination

## Flags

Flag | Aliases | Description
---- | ------- | -----------
`--force` | `-f` | Overwrite existing destination without asking.

## Details

* To simplify the implementation and support multiple backends a `copy` or `move` operation will always decrypt and re-encrypt all affected secrets. Even if moving encrypted files around might be possible.
* You can move a secret to another secret, i.e. overwrite the destination. But `gopass` won't let you move a directory over a file. In that case you have to delete the destination first.

4 changes: 2 additions & 2 deletions docs/commands/show.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `show` command

This `show` command is the most important and most frequently used command.
The `show` command is the most important and most frequently used command.
It allows displaying and copying the content of the secrets managed by gopass.

## Synopsis
Expand Down Expand Up @@ -28,7 +28,7 @@ Flag | Aliases | Description
`--password` | `-o` | Display only the password. For use in scripts. Takes precedence over other flags.
`--revision` | `-r` | Display a specific revision of the entry. Use an exact version identifier from `gopass history` or the special `-N` syntax. Does not work with native (e.g. git) refs.

## Modes of operation
## Details

This section describes the expected behaviour of the `show` command with respect to different combinations of flags and config options.

Expand Down
18 changes: 18 additions & 0 deletions docs/commands/sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# `sync` command

The `sync` command is the preferred way to manually synchronize changes between
your local stores and any configured remotes.

You can always `cd` into a git-based store and manually perform git operations,
but executing these through `gopass git` is deprecated and might be removed
at soe point.

Note: `gopass sync` only supports one remote per store.

## Flags

Flag | Description
---- | -----------
`--store` | Only sync a specific sub store


9 changes: 4 additions & 5 deletions internal/action/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,7 @@ func (s *Action) GetCommands() []*cli.Command {
Usage: "Search for secrets",
Description: "" +
"This command will first attempt a simple pattern match on the name of the " +
"secret. If that yields no results, it will trigger a fuzzy search. " +
"If there is an exact match it will be shown directly; if there are " +
"secret. If there is an exact match it will be shown directly; if there are " +
"multiple matches, a selection will be shown.",
Before: s.Initialized,
Action: s.FindNoFuzzy,
Expand All @@ -232,8 +231,8 @@ func (s *Action) GetCommands() []*cli.Command {
Usage: "Copy the password into the clipboard",
},
&cli.BoolFlag{
Name: "force",
Aliases: []string{"f"},
Name: "unsafe",
Aliases: []string{"u", "force", "f"},
Usage: "In the case of an exact match, display the password even if safecontent is enabled",
},
},
Expand Down Expand Up @@ -587,7 +586,7 @@ func (s *Action) GetCommands() []*cli.Command {
},
&cli.BoolFlag{
Name: "folders",
Aliases: []string{"fo"},
Aliases: []string{"d"},
Usage: "Print flat list of folders",
},
&cli.BoolFlag{
Expand Down
1 change: 1 addition & 0 deletions internal/action/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ func (s *Action) syncMount(ctx context.Context, mp string) error {
numMP = len(l)
}

// TODO: Remove this hard coded check
if sub.Storage().Name() == "fs" {
out.Yellow(ctxno, "\n WARNING: Mount uses Storage backend 'fs'. Not syncing!\n")
} else {
Expand Down

0 comments on commit dc65f6e

Please sign in to comment.