Skip to content

CLI Guide ​

The Enclosed Command-Line Interface (CLI) allows you to create and manage secure notes directly from your terminal. This guide will walk you through installing the CLI, creating and viewing notes, and configuring the CLI for different use cases.

Installation ​

You can install the Enclosed CLI globally using npm, yarn, or pnpm.

Using npm ​

bash
npm install -g @enclosed/cli

Using yarn ​

bash
yarn global add @enclosed/cli

Using pnpm ​

bash
pnpm add -g @enclosed/cli

Once installed, you can use the enclosed command in your terminal.

Creating a Note ​

The primary function of the Enclosed CLI is to create secure notes. You can create a note with a simple command.

Basic Usage ​

To create a note with the content "Hello, World!", run:

bash
enclosed create "Hello, World!"

This command will return a URL that you can share with the intended recipient.

Using stdin ​

You can also create a note from the contents of a file or the output of another command:

bash
cat file.txt | enclosed create

This is useful for sending longer text or data generated by other commands.

With Full Options ​

The CLI allows you to set additional security options such as password protection, self-destruction after reading, and time-to-live (TTL) for the note:

bash
enclosed create --deleteAfterReading --password "mypassword" --ttl 3600 "This is a secure message."

Options Summary ​

  • --deleteAfterReading: Enable self-destruction after the note is read.
  • --password <password>: Protect the note with a password.
  • --ttl <seconds>: Set the time-to-live (TTL) for the note in seconds.

Viewing a Note ​

The Enclosed CLI can also be used to view notes directly from the terminal.

Basic Usage ​

To view a note, use the view command followed by the note's URL:

bash
enclosed view <note-url>

If the note is password-protected, the CLI will prompt you for the password.

Providing the Password Directly ​

You can provide the password directly with the --password option to avoid the prompt:

bash
enclosed view --password "mypassword" <note-url>

Configuring the Enclosed Instance ​

By default, the CLI uses the public instance at enclosed.cc. If you are running your own instance of Enclosed, you can configure the CLI to use your server.

Set the Instance URL ​

To set your instance URL, run:

bash
enclosed config set instance-url https://your-enclosed-instance.com

This command will configure the CLI to use your instance for creating and viewing notes.

Updating the CLI ​

To update the Enclosed CLI to the latest version, simply re-run the installation command:

Using npm ​

bash
npm install -g @enclosed/cli

Using yarn ​

bash
yarn global add @enclosed/cli

Using pnpm ​

bash
pnpm add -g @enclosed/cli

This will ensure that you have the latest features and security updates.

Uninstalling the CLI ​

If you need to remove the Enclosed CLI, you can uninstall it with the following commands:

Using npm ​

bash
npm uninstall -g @enclosed/cli

Using yarn ​

bash
yarn global remove @enclosed/cli

Using pnpm ​

bash
pnpm remove -g @enclosed/cli

Advanced Usage ​

For more advanced usage, you can refer to the CLI's help command, which provides detailed information on all available commands and options:

bash
enclosed --help

This will display the complete list of commands and options available in the Enclosed CLI.

Next Steps ​

Now that you're familiar with the basic and advanced features of the Enclosed CLI, you can start integrating it into your workflows. Whether you're automating note creation or managing secure communication from the terminal, the Enclosed CLI is a powerful tool for ensuring your messages remain private and secure.