Command Line
The Nocarta Desktop app has its own command, nocarta --cli. You type it in a terminal. It talks only to the Nocarta app running on the same computer. It does not go anywhere else on its own.
Use it to put a secret into another program without copying it by hand, or to start an Automation, a Recipe or a Batch from a terminal.
Install the short nocarta command once:
- macOS: add this line to
~/.zprofile, then open a new terminal:alias nocarta='/Applications/Nocarta.app/Contents/MacOS/Nocarta --cli' - Linux (.deb): it is installed with the app.
- Windows: it is installed with the app. Open a new terminal after installing.
Without it, start the app itself with --cli: /Applications/Nocarta.app/Contents/MacOS/Nocarta --cli … on macOS, /opt/Nocarta/nocartaclient --cli … on Linux, Nocarta.exe --cli … in the folder you installed the app to on Windows. The examples below write nocarta --cli; with the short command, nocarta without --cli works too.
Before you start
- The Nocarta Desktop app must be open and signed in.
- For a Tier 2 secret, the vault must be unlocked in the app.
- Secret commands work on macOS, Windows and Linux.
Secret commands
Name a secret by its name, exactly as it appears on the Secrets page, or by its id. If two secrets have the same name, the command stops and lists their ids. Use one of the ids.
List your secrets
nocarta --cli secret list
Shows each secret's name, type, Tier 1 or Tier 2, and id. It does not show any value.
Print a value
nocarta --cli secret get "Mail server" | some-program
TOKEN=$(nocarta --cli secret get "Mail server")
Sends the value to another program or into a shell variable. By default you get the secret's value. Add --field username or --field url to get that field instead.
The command refuses to print the value on the terminal screen, because it would stay in the terminal's history. To see it on screen anyway, add --show.
Copy a value
nocarta --cli secret copy "Mail server"
Puts the value on the clipboard. The clipboard is cleared after 30 seconds, unless you copied something else meanwhile.
- macOS: the value is marked so that clipboard history apps do not keep it.
- Windows: the value is kept out of clipboard history (Win+V) and is not synced to your other devices.
- Linux: a clipboard manager may keep it. Check your clipboard manager's settings.
Give a value to one command
nocarta --cli secret run "Mail server" --env MAIL_PASSWORD -- send-report --daily
Starts the command after -- with the value in the environment variable you name. Only that command and the programs it starts see the value. Your terminal does not.
Careful: a program that prints or logs its environment, writes it into an error report, or passes it to a container, exposes the value. Use secret run only with programs you trust to keep it.
Run commands
nocarta --cli run-automation <id>
nocarta --cli run-recipe <id>
nocarta --cli run-batch <id>
nocarta --cli stop <id>
The run happens in the Nocarta app on this computer, exactly as when you press Run there. The command waits and finishes with the run's result.
Approval
Every secret command, every run start and every stop asks you first:
- macOS: Touch ID, or your login password when Touch ID is not available.
- Windows: Windows Hello (face, fingerprint or PIN). Without Windows Hello set up, the command is refused.
- Linux: your vault master password, typed in the Nocarta app window.
Any program on your computer can type a command. Only you can answer this question. That is how a harmful program is kept away from your secrets.
One approval covers the terminal tab it came from (on Windows, the terminal window) for a few minutes: 10 by default, changeable in the app's settings. A new tab asks again. Locking the screen withdraws every approval.
Exit codes
A script can check the result of each command:
| Code | Meaning |
|---|---|
0 | Done |
1 | Something went wrong. The message says what. |
3 | No secret or run with that name or id |
7 | The command was typed wrong, or it would print a value on the terminal screen |
8 | Not available on this computer |
9 | Not approved |
10 | The vault is locked. Unlock it in the app. |
Windows
Everything above works the same on Windows. Write the examples in your terminal's own way: in PowerShell, $token = nocarta secret get "Mail server"; in Command Prompt, use secret run or secret copy.
Need More Help?