2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

style: bench.commands.utils help added

This commit is contained in:
Gavin D'souza 2020-02-18 18:47:38 +05:30
parent 9d00bc743e
commit 043f044853

View File

@ -1,5 +1,10 @@
# imports - standard imports
import copy
import os
import sys
# imports - third party imports
import click import click
import sys, os, copy
@click.command('start', help="Start Frappe development processes") @click.command('start', help="Start Frappe development processes")
@ -23,7 +28,8 @@ def restart(web, supervisor, systemd):
if get_config('.').get('restart_systemd_on_update') or systemd: if get_config('.').get('restart_systemd_on_update') or systemd:
restart_systemd_processes(bench_path='.', web_workers=web) restart_systemd_processes(bench_path='.', web_workers=web)
@click.command('set-nginx-port', help="Set nginx port for site")
@click.command('set-nginx-port', help="Set NGINX port for site")
@click.argument('site') @click.argument('site')
@click.argument('port', type=int) @click.argument('port', type=int)
def set_nginx_port(site, port): def set_nginx_port(site, port):
@ -31,7 +37,7 @@ def set_nginx_port(site, port):
set_nginx_port(site, port) set_nginx_port(site, port)
@click.command('set-ssl-certificate', help="Set ssl certificate path for site") @click.command('set-ssl-certificate', help="Set SSL certificate path for site")
@click.argument('site') @click.argument('site')
@click.argument('ssl-certificate-path') @click.argument('ssl-certificate-path')
def set_ssl_certificate(site, ssl_certificate_path): def set_ssl_certificate(site, ssl_certificate_path):
@ -39,79 +45,74 @@ def set_ssl_certificate(site, ssl_certificate_path):
set_ssl_certificate(site, ssl_certificate_path) set_ssl_certificate(site, ssl_certificate_path)
@click.command('set-ssl-key') @click.command('set-ssl-key', help="Set SSL certificate private key path for site")
@click.argument('site') @click.argument('site')
@click.argument('ssl-certificate-key-path') @click.argument('ssl-certificate-key-path')
def set_ssl_certificate_key(site, ssl_certificate_key_path): def set_ssl_certificate_key(site, ssl_certificate_key_path):
"Set ssl certificate private key path for site"
from bench.config.site_config import set_ssl_certificate_key from bench.config.site_config import set_ssl_certificate_key
set_ssl_certificate_key(site, ssl_certificate_key_path) set_ssl_certificate_key(site, ssl_certificate_key_path)
@click.command('set-url-root') @click.command('set-url-root', help="Set URL root for site")
@click.argument('site') @click.argument('site')
@click.argument('url-root') @click.argument('url-root')
def set_url_root(site, url_root): def set_url_root(site, url_root):
"Set url root for site"
from bench.config.site_config import set_url_root from bench.config.site_config import set_url_root
set_url_root(site, url_root) set_url_root(site, url_root)
@click.command('set-mariadb-host') @click.command('set-mariadb-host', help="Set MariaDB host for bench")
@click.argument('host') @click.argument('host')
def set_mariadb_host(host): def set_mariadb_host(host):
"Set MariaDB host for bench"
from bench.utils import set_mariadb_host from bench.utils import set_mariadb_host
set_mariadb_host(host) set_mariadb_host(host)
@click.command('set-redis-cache-host')
@click.command('set-redis-cache-host', help="Set Redis cache host for bench")
@click.argument('host') @click.argument('host')
def set_redis_cache_host(host): def set_redis_cache_host(host):
""" """
Set Redis cache host for bench Usage: bench set-redis-cache-host localhost:6379/1
Eg: bench set-redis-cache-host localhost:6379/1
""" """
from bench.utils import set_redis_cache_host from bench.utils import set_redis_cache_host
set_redis_cache_host(host) set_redis_cache_host(host)
@click.command('set-redis-queue-host')
@click.command('set-redis-queue-host', help="Set Redis queue host for bench")
@click.argument('host') @click.argument('host')
def set_redis_queue_host(host): def set_redis_queue_host(host):
""" """
Set Redis queue host for bench Usage: bench set-redis-queue-host localhost:6379/2
Eg: bench set-redis-queue-host localhost:6379/2
""" """
from bench.utils import set_redis_queue_host from bench.utils import set_redis_queue_host
set_redis_queue_host(host) set_redis_queue_host(host)
@click.command('set-redis-socketio-host')
@click.command('set-redis-socketio-host', help="Set Redis socketio host for bench")
@click.argument('host') @click.argument('host')
def set_redis_socketio_host(host): def set_redis_socketio_host(host):
""" """
Set Redis socketio host for bench Usage: bench set-redis-socketio-host localhost:6379/3
Eg: bench set-redis-socketio-host localhost:6379/3
""" """
from bench.utils import set_redis_socketio_host from bench.utils import set_redis_socketio_host
set_redis_socketio_host(host) set_redis_socketio_host(host)
@click.command('set-default-site') @click.command('set-default-site', help="Set default site for bench")
@click.argument('site') @click.argument('site')
def set_default_site(site): def set_default_site(site):
"Set default site for bench"
from bench.utils import set_default_site from bench.utils import set_default_site
set_default_site(site) set_default_site(site)
@click.command('download-translations') @click.command('download-translations', help="Download latest translations")
def download_translations(): def download_translations():
"Download latest translations"
from bench.utils import download_translations_p from bench.utils import download_translations_p
download_translations_p() download_translations_p()
@click.command('renew-lets-encrypt')
@click.command('renew-lets-encrypt', help="Renew Let's Encrypt certificate")
def renew_lets_encrypt(): def renew_lets_encrypt():
"Renew Let's Encrypt certificate"
from bench.config.lets_encrypt import renew_certs from bench.config.lets_encrypt import renew_certs
renew_certs() renew_certs()
@ -129,7 +130,6 @@ def shell(bench_path='.'):
os.chdir('sites') os.chdir('sites')
os.execve(env['SHELL'], [env['SHELL']], env) os.execve(env['SHELL'], [env['SHELL']], env)
@click.command('backup', help="Backup single site") @click.command('backup', help="Backup single site")
@click.argument('site') @click.argument('site')
def backup_site(site): def backup_site(site):
@ -158,8 +158,7 @@ def backup_all_sites():
def release(app, bump_type, from_branch, to_branch, owner, repo_name, remote, dont_frontport): def release(app, bump_type, from_branch, to_branch, owner, repo_name, remote, dont_frontport):
from bench.release import release from bench.release import release
frontport = not dont_frontport frontport = not dont_frontport
release(bench_path='.', app=app, bump_type=bump_type, from_branch=from_branch, to_branch=to_branch, release(bench_path='.', app=app, bump_type=bump_type, from_branch=from_branch, to_branch=to_branch, remote=remote, owner=owner, repo_name=repo_name, frontport=frontport)
remote=remote, owner=owner, repo_name=repo_name, frontport=frontport)
@click.command('prepare-beta-release', help="Prepare major beta release from develop branch") @click.command('prepare-beta-release', help="Prepare major beta release from develop branch")