Introduction
Welcome to the comprehensive guide on Bench CLI, a powerful feature in Empress for developers. In this guide, we’ll delve into the core functionalities of Bench CLI and demonstrate how to leverage its diverse capabilities for efficient software development and customization.
Introduction to Bench CLI
Bench CLI is a command-line interface that provides developers with a host of commands to manage and manipulate their Empress sites. From creating new applications to managing configurations, and running tests to importing data, Bench CLI is a robust tool designed to streamline and enhance the software development process.
General Usage
Bench CLI commands are primarily divided into several categories, including General Usage, Config, Development, Scheduler, and Data Import. Each category encompasses various commands aimed at different functionalities.
Let’s begin with the general usage commands:
bench --version
bench version
bench src
bench --help
bench [command] --help
bench init [bench-name]
bench --site [site-name] COMMAND
bench update
bench restart
bench backup
bench backup-all-sites
bench restore
bench migrate
bench migrate-env [python-version]
bench --site [sitename] set-admin-password [password]
bench destroy-all-sessions
These commands provide information about the Bench CLI version, show directories, and help developers initialize a new bench, update benches, restart services, back up and restore data, migrate data, and manage sessions.
Config
The configuration commands give you control over your bench’s settings:
bench config
bench setup
bench set-nginx-port [sitename] [port]
You can use these commands to change the bench’s configuration, set up components, and set the site’s port in production.
Development
The development commands are designed to streamline your development process:
bench new-app [app-name]
bench get-app [repo-link]
bench install-app [app-name]
bench remove-from-installed-apps [app-name]
bench uninstall-app [app-name]
bench remove-app [app-name]
bench --site [sitename] --force reinstall
bench new-site [sitename]
bench use [site]
bench drop-site
bench set-config [key] [value]
bench console
bench execute
bench --site [sitename] mariadb
bench --site [sitename] export-fixtures [--app TEXT]
bench run-tests
bench disable-production
bench serve
These commands allow developers to create, remove, and manage applications and sites. They also provide features for running tests, setting configurations, and starting a development web server.
Scheduler
The scheduler commands enable developers to manage scheduled tasks and jobs:
bench enable-scheduler
bench doctor
bench show-pending-jobs
bench purge-jobs
Data Import
The data import commands assist developers with bulk data import:
bench data-import
Conclusion
In conclusion, the Bench CLI is a critical feature in Empress that offers a wide array of functionalities. By mastering Bench CLI, developers can effectively manage, debug, and customize applications, contributing significantly to the creation of robust business solutions.