Hyphen CLI
Work seamlessly with Hyphen from the command line
Hyphen CLI can be installed in macOS, Windows and Linux environments. In this guide, you will learn how to install and update command-line interface (CLI).
Installation
sh -c "$(curl -fsSL <https://cdn.hyphen.ai/install/install.sh)">
powershell -c "irm https://cdn.hyphen.ai/install/install.ps1 | iex"
Commands
hyphen
The root command for the Hyphen CLI. For convience, the alias hx
can be used in place of hyphen
for all commands.
For convenience, the alias
hx
can be used in place ofhyphen
for all commands.
Usage:
hyphen [command]
hx [command]
Core Commands
auth
: Authenticate with Hyphenupdate
: Update the Hyphen CLIinit
: Initialize an appset-org
: Set the organization IDset-project
: Set the project IDversion
: Display the version of the Hyphen CLIpush
: Upload and encrypt environment variables for a specific environmentpull
: Retrieve and decrypt environment variables for a specific environmentlink
: Shorten a URL and optionally generate a QR codeapp
: Manage applicationsproject
: Manage projectsenv
: Manage environmentshelp
: List available commands, flags, and their descriptions
Global Flags
--org
: Organization ID (e.g., org_123)--proj
: Project ID (e.g., proj_123)--env
: Environment ID (e.g., env_12345)--yes
, -y: Automatically answer yes for prompts--no
: Automatically answer no for prompts
Authentication
Authenticate with Hyphen by entering the hyphen auth
command. This will start the OAuth flow (opens a browser window and ask you to sign in with username and password) and save the credentials to your session.
hyphen auth
API Key Authentication
If you are authenticating in a CI/CD environment and need to authenticate using an API key, you can do so in 2 ways:
- Use API Key
--use-api-key
will look for the HYPHEN_API_KEY environment variable first and if not found it will prompt for the key.hyphen auth -- use-api-key
- Set API Key
--set-api-key VALUE
will expect an inline value. The risk in using this method is just in exposing the secret in your terminal output, but it's provided for convenience.hyphen auth --set-api-key VALUE
Commands
auth
auth
Starts the OAuth flow, opens a browser window for you to sign in with a username and password and saves the credentials to your session.
hyphen auth
update
update
Use update
to get the latest version of the Hyphen CLI
hyphen update
init
init
Initialize an app, which creates the .hx
and .hxkey
files
hyphen init <app-name> [flags]
Flags
--id, i
: APP ID (optional)--help, -h
: Help forinit
command
Examples
hyphen init
hyphen init "My New App"
hyphen init "My New App" --id my-custom-app-id
set-org
set-org
Set the organization ID in .hx
.
hyphen set-org <id>
Flags
--global
: Set the org ID globally--help, -h
: Help forset-org
command
set-project
set-project
Set the project ID in .hx
.
hyphen set-project <id>
Flags
--global
: Set the project ID globally--help, -h
: Help forset-project
command
version
version
Display the current version of the Hyphen CLI
hyphen version
push
push
Encrypt and uploads local environment variables to Hyphen.
This command allows you to:
- Push all environments found in local .env files when no environment is specified
- Push a specific environment by name
- Encrypt and securely store your environment variables in Hyphen
The command looks for .env files in the current directory with the naming convention .env.[environment_name]
.
hyphen push [flags]
Flags
--environment, -e
: Specific environment(s) to push to (e.g. development, production, default)--help, -h
: Help forpush
command
pull
pull
Retrieves environment variables from Hyphen and decrypts them into local .env files.
This command allows you to:
- Pull a specific environment by name
- Pull all environments for the application
The pulled environments will be decrypted and saved as .env.[environment_name]
files in your current directory.
hyphen pull [flags]
Flags
--environment, -e
: Specific environment(s) to pull from (e.g. development, production, default)--force
: Force overwrite of locally modified environment files--version
: Specify a version to pull--help, -h
: Help forpull
command
link
link
Shorten a URL and optionally generate a QR code.
hyphen link <long_url> [flags]
Flags
--code
: Custom short code--domain
: The domain to use when shortening--qr
: Generate a QR code--tag
: Tag the shortened URL.--title
: The title for the shortened URL--help, -h
: Help forlink
command
app
app
Manage applications.
Subcommands
create
: Create a new application in Hyphenget
: Get an applist
: List applications in your organization and project
app create
app create
This command allows you to:
- Create a new application with a specified name
- Optionally provide a custom app ID or use an automatically generated one
- Associate the new app with your current organization and project
hyphen app create <app-name> [flags]
Flags
-h, --help
Help forapp create
command--id, i
: App ID (optional)
app get
app get
This command allows you to:
- Fetch detailed information about a specific application
- Use either the application name or ID as the identifier
The command will display various details about the application, including:
- Project information (ID and name)
- Application details (name, alternate ID, and ID)
- Organization information (ID and name)
hyphen app get <app-name or app-id> [flags]
Flags
-h, --help
Help forapp create
command
app list
app list
List applications in your organization and project
hyphen app list [flags]
Flags
-h, --help
Help forapp list
--page
: Page number (default 1)--page-size
: Number of results per page (default 10)--table
: Display results in a table format
project
project
Manage projects within your organization.
Subcommands
create
: Create a new projectget
: Get a projectlist
: List projects in your organization
project create
project create
This command allows you to:
- Create a new project with a specified name
- Automatically generate an alternate ID based on the project name
The project name:
- Can include spaces and special characters
- Will be trimmed of leading/trailing spaces and quotes
The alternate ID:
- Is automatically generated from the project name
- Contains only alphanumeric characters and hyphens
- Replaces spaces with hyphens and removes other special characters
After creation, you'll receive a summary of the new project, including its:
- Name
- ID (assigned by Hyphen)
- Alternate ID (generated from the name)
hyphen project create <project-name> [flags]
Flags
-h, --help
Help forapp create
command
project get
project get
This command allows you to:
- Fetch detailed information about a specific project
- Use either the project name or ID as the identifier
The command will display the following details about the project:
- Name: The project's full name
- ID: The unique identifier assigned by Hyphen
- AlternateID: The human-readable identifier generated from the project name
hyphen project get <project-name or project-id> [flags]
Flags
-h, --help
Help forproject get
command
project list
project list
This command allows you to:
- View all projects in your current organization
- See key details of each project at a glance
For each project, the command will display:
- Name: The project's full name
- ID: The unique identifier assigned by Hyphen
- AlternateID: The human-readable identifier generated from the project name
If no projects are found in your organization, you'll be informed accordingly.
The projects are displayed in a list format, with each project's details separated by an empty line for better readability.
Note: The list is fetched based on your current organization context. Ensure you're in the correct organization before running this command.
hyphen project list [flags]
Flags
-h, --help
Help forproject list
env
env
Manage environment .env secrets.
Subcommands
list
: List environment variables in Hyphenlist-versions
:List versions of an environment in Hyphenpull
: Pull and decrypt environment variables from Hyphenpush
: Push local environment variables to Hyphenrotate-key
: Rotate the encryption key and update all environmentsrun
: Run your app with the specified environment
Flags
--enivoronment, -e
: Project Environment ID (e.g., pevr_12345)-h, --help
Help forproject list
env list
env list
The env list
command displays environment variables stored in Hyphen for your current project.
This command allows you to:
- View all environments associated with your project
- See key details about each environment, including ID, version, secret count, size, and publish date
- Display results in either a detailed list format or a concise table format
The information displayed for each environment includes:
- ID: The unique identifier for the environment (default for the main environment)
- Version: The current version number of the environment
- Secrets Count: The number of secret variables stored in the environment
- Size: The total size of the environment data
- Published: The date and time when the environment was last published
hyphen env list [flags]
Flags
-h, --help
: help forenv list
--page
: Page number (default 1)--page-size
: Number of results per page (default 10)--table
: Display results in a table format
env list-versions
env list-versions
The env list-versions
command displays different versions of a specific environment stored in Hyphen for your current project.
This command allows you to:
- View all versions of a specific environment
- See key details about each version, including ID, version number, secret count, size, and publish date
- Display results in either a detailed list format or a concise table format
The information displayed for each version includes:
- ID: The unique identifier for the environment
- Version: The version number of the environment
- Secrets Count: The number of secret variables stored in this version
- Size: The total size of the environment data for this version
- Published: The date and time when this version was published
hyphen env list-versions <environment-id> [flags]
Flags
-h, --help
: help forenv list
--page
: Page number (default 1)--page-size
: Number of results per page (default 10)--table
: Display results in a table format
env push
env push
Encrypt and uploads local environment variables to Hyphen.
This command allows you to:
- Push all environments found in local .env files when no environment is specified
- Push a specific environment by name
- Encrypt and securely store your environment variables in Hyphen
The command looks for .env files in the current directory with the naming convention .env.[environment_name]
.
hyphen env push [flags]
Flags
--environment, -e
: Specific environment(s) to push to (e.g. development, production, default)--help, -h
: Help forpush
command
env pull
env pull
Retrieves environment variables from Hyphen and decrypts them into local .env files.
This command allows you to:
- Pull a specific environment by name
- Pull all environments for the application
The pulled environments will be decrypted and saved as .env.[environment_name]
files in your current directory.
hyphen env pull [flags]
Flags
--environment, -e
: Specific environment(s) to pull from (e.g. development, production, default)--force
: Force overwrite of locally modified environment files--version
: Specify a version to pull--help, -h
: Help forpull
command
env rotate-key
env rotate-key
Rotates the encryption key and updates all environments with the new key.
hyphen env rotate-key [flags]
Flags
--force
: Force overwrite of locally modified environment files-h, --help
: help forenv list
env run
env run
Executes your application with the specified environment variables.
hyphen env run [environment] -- [command]
Flags
-h, --help
: help for `env list
help
help
List available commands, flags, and their descriptions
hyphen help
Updated 11 days ago