Skip to content

Commit

Permalink
add command to list available mounters
Browse files Browse the repository at this point in the history
  • Loading branch information
infeo committed Oct 24, 2024
1 parent bb4dbbd commit 47cb717
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 8 deletions.
16 changes: 10 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ This is a minimal command-line application that unlocks a single vault of vault

Download the zip file via [GitHub Releases](https://github.com/cryptomator/cli/releases) and unzip it to your desired directory, e.g.

```sh
```shell
curl -L https://github.com/cryptomator/cli/releases/download/0.7.0/cryptomator-cli-0.7.0-mac-arm64.dmg --output cryptomator-cli.zip
unzip cryptomator-cli.zip
```

Afterwards, you can directly run Cryptomator-CLI:
```sh
```shell
cryptomator-cli unlock \
--password:stdin \
--mounter=org.cryptomator.frontend.fuse.mount.LinuxFuseMountProvider \
Expand All @@ -25,22 +25,26 @@ cryptomator-cli unlock \

For a complete list of options, use the`--help` option.
```shell
cryptomator-cli unlock --help`
cryptomator-cli --help`
```

## FileSystem Integration

For an OS integration of your unlocked vault, cryptomator-cli relies on third party libraries which must be installed seperately.
To integrate the unlocked vault into the filesystem, cryptomator-cli relies on third party libraries which must be installed separately.
These are:
* [WinFsp](https://winfsp.dev/) for Windows
* [macFUSE](https://osxfuse.github.io/) or [FUSE-T](https://www.fuse-t.org/) for macOS
* and [libfuse](https://github.com/libfuse/libfuse) for Linux/BSD systems (normally provided by a fuse3 package of your distro, e.g. [ubuntu](https://packages.ubuntu.com/noble/fuse3))

As a fallback, you can [skip filesystem integration](README.md#skip-filesystem-integration).
As a fallback, you can [skip filesystem integration](README.md#skip-filesystem-integration) by using WebDAV.

## Selecting the Mounter

TODO
To list all available mounters, use the `list-mounters` subcommand:
```shell
cryptomator-cli list-mounters
```
Pick one from the printed list and use it as input for the `--mounter` option.

## Skip Filesystem Integration

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/cryptomator/cli/CryptomatorCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
mixinStandardHelpOptions = true,
version = "${org.cryptomator.cli.version}",
description = "Unlocks a cryptomator vault and mounts it into the system.",
subcommands = Unlock.class)
subcommands = { Unlock.class, ListMounters.class})
public class CryptomatorCli {

private static final Logger LOG = LoggerFactory.getLogger(CryptomatorCli.class);
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/org/cryptomator/cli/ListMounters.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.cryptomator.cli;

import org.cryptomator.integrations.common.IntegrationsLoader;
import org.cryptomator.integrations.mount.MountService;
import picocli.CommandLine;

import java.util.concurrent.Callable;

@CommandLine.Command(name = "list-mounters",
headerHeading = "Usage:%n%n",
synopsisHeading = "%n",
descriptionHeading = "%nDescription:%n%n",
optionListHeading = "%nOptions:%n",
header = "Lists available mounters",
description = "Prints a list of available mounters to STDIN. A mounter is is the object to mount/integrate the unlocked vault into the local filesystem. In the GUI app, mounter is named \"volume type\".",
mixinStandardHelpOptions = true)
public class ListMounters implements Callable<Integer> {

@CommandLine.Option(names = {"--withDisplayName"}, description = "Prints also the display name of each mounter, as used in the GUI app.")
boolean withDisplayName = false;

@Override
public Integer call() throws Exception {
IntegrationsLoader.loadAll(MountService.class)
.forEach(s -> System.out.println(s.getClass().getName() + (withDisplayName? " | " + s.displayName():"")));
return 0;
}
}
14 changes: 13 additions & 1 deletion src/main/java/org/cryptomator/cli/Unlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@
import java.security.SecureRandom;
import java.util.concurrent.Callable;

@Command(name = "unlock")
@Command(name = "unlock",
header = "Unlocks a vault",
description = "Unlocks and mounts the given cryptomator vault, identified by the path to the vault directory." +
"The unlocked vault is mounted into the local filesystem by the specified mounter." +
"For a list of available mounters, use the `list-mounters` subcommand.",
parameterListHeading = "%nParameters:%n",
headerHeading = "Usage:%n%n",
synopsisHeading = "%n",
descriptionHeading = "%nDescription:%n%n",
optionListHeading = "%nOptions:%n",

mixinStandardHelpOptions = true)
public class Unlock implements Callable<Integer> {

private static final Logger LOG = LoggerFactory.getLogger(Unlock.class);
Expand Down Expand Up @@ -51,6 +62,7 @@ void setMaxCleartextNameLength(int input) {
}
maxCleartextNameLength = input;
}

private int maxCleartextNameLength = 0;

private SecureRandom csprng = null;
Expand Down

0 comments on commit 47cb717

Please sign in to comment.