Skip to content

Commit

Permalink
Add shortcut argument for some command options
Browse files Browse the repository at this point in the history
  • Loading branch information
sveetch committed Dec 21, 2013
1 parent 4968c08 commit c647a2c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions optimus/cli/build.py
Expand Up @@ -8,8 +8,8 @@

from optimus.logs import init_logging

@arg('--settings', default='settings', help="Python path to the settings module")
@arg('--loglevel', default='info', choices=['debug','info','warning','error','critical'], help="The minimal verbosity level to limit logs output")
@arg('-s', '--settings', default='settings', help="Python path to the settings module")
@arg('-l', '--loglevel', default='info', choices=['debug','info','warning','error','critical'], help="The minimal verbosity level to limit logs output")
@arg('--logfile', default=None, help="A filepath that if setted, will be used to save logs output")
#@arg('--dry-run', default=False, help="Parse page templates, scan them to search their dependancies but don't build them")
def build(args):
Expand Down
22 changes: 15 additions & 7 deletions optimus/cli/po.py
Expand Up @@ -2,18 +2,19 @@
"""
Command line action to manage translation PO files with pybabel
"""
import datetime, glob, os, tempfile
import datetime, os

from argh import arg

from optimus.logs import init_logging
from optimus.i18n import I18NManager

@arg('--init', default=False, help="Initialize structure, create template catalog (POT) and initialize catalogs (PO)")
@arg('--update', default=False, help="Extract translations, update the template catalog (POT) and update the catalogs (PO)")
@arg('--compile', default=False, help="Process to compilation of catalogs")
@arg('--settings', default='settings', help="Python path to the settings module")
@arg('--loglevel', default='info', choices=['debug','info','warning','error','critical'], help="The minimal verbosity level to limit logs output")
@arg('-i', '--init', default=False, help="Initialize structure, create template catalog (POT) and initialize catalogs (PO)")
@arg('-u', '--update', default=False, help="Extract translations, update the template catalog (POT) and update the catalogs (PO)")
@arg('-c', '--compile', default=False, help="Process to compilation of catalogs")
@arg('-b', '--backup', default=False, help="Make a backup of the locale directory before doing anything")
@arg('-s', '--settings', default='settings', help="Python path to the settings module")
@arg('-l', '--loglevel', default='info', choices=['debug','info','warning','error','critical'], help="The minimal verbosity level to limit logs output")
@arg('--logfile', default=None, help="A filepath that if setted, will be used to save logs output")
def po(args, init=False, update=False, compile=False):
"""
Expand All @@ -32,7 +33,14 @@ def po(args, init=False, update=False, compile=False):

i18n = I18NManager(root_logger, settings)

# TODO: Should we do this automatically to prevent error on missing files
# TODO: * Copy the actual locale directory to a temporary directory
# * If process is success, remove previous backup dir if exists then promote the temp backup dir as the current backup
# * If process goes wrong, just remove the temp backup dir
# -> Always keeping only one backup dir and allways for a successful process
if args.backup:
pass

# NOTE: Should we do this automatically to prevent error on missing files
# OR should we only do checking before and abort on the first missing file ?
if args.init or args.update or args.compile:
i18n.init_locales_dir()
Expand Down
4 changes: 2 additions & 2 deletions optimus/cli/runserver.py
Expand Up @@ -14,8 +14,8 @@
import cherrypy

@arg('hostname', help="Hostname to bind the server to, use PORT or ADDRESS:PORT")
@arg('--settings', default='settings', help='Python path to the settings module')
@arg('--loglevel', default='info', choices=['debug','info','warning','error','critical'], help='The minimal verbosity level to limit logs output')
@arg('-s', '--settings', default='settings', help='Python path to the settings module')
@arg('-l', '--loglevel', default='info', choices=['debug','info','warning','error','critical'], help='The minimal verbosity level to limit logs output')
@arg('--logfile', default=None, help='A filepath that if setted, will be used to save logs output')
@arg('--silent', default=False, help="If setted, logs output won't be printed out")
def runserver(args):
Expand Down
4 changes: 2 additions & 2 deletions optimus/cli/watch.py
Expand Up @@ -10,8 +10,8 @@

from optimus.logs import init_logging

@arg('--settings', default='settings', help='Python path to the settings module')
@arg('--loglevel', default='info', choices=['debug','info','warning','error','critical'], help='The minimal verbosity level to limit logs output')
@arg('-s', '--settings', default='settings', help='Python path to the settings module')
@arg('-l', '--loglevel', default='info', choices=['debug','info','warning','error','critical'], help='The minimal verbosity level to limit logs output')
@arg('--logfile', default=None, help='A filepath that if setted, will be used to save logs output')
@arg('--silent', default=False, help="If setted, logs output won't be printed out")
def watch(args):
Expand Down

0 comments on commit c647a2c

Please sign in to comment.