Skip to content

Commit

Permalink
Allow --varformat='' to disable all formats
Browse files Browse the repository at this point in the history
Also permit empty formats, such as --varformat=',',
to be discarded instead of raising an Exception.

Fixes mozilla#83
  • Loading branch information
jayvdb committed Oct 13, 2016
1 parent a59a9bb commit e9e0340
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dennis/cmdline.py
Expand Up @@ -75,7 +75,7 @@ def err(*s):
def format_formats():
formats = sorted(get_available_formats().items())
lines = [
'Available Variable Formats:',
'Available Variable Formats (All enabled by default):',
'',
'\b',
]
Expand Down Expand Up @@ -221,9 +221,11 @@ def lint(ctx, quiet, color, varformat, rules, excluderules, reporter, errorsonly
# Remove excluded rules
rules = [rule for rule in rules if rule not in excludes]

varformats = [item for item in varformat.split(',') if item]

# Build linters and lint
linter = Linter(varformat.split(','), rules)
templatelinter = TemplateLinter(varformat.split(','), rules)
linter = Linter(varformats, rules)
templatelinter = TemplateLinter(varformats, rules)

po_files = []
for item in path:
Expand Down Expand Up @@ -508,8 +510,10 @@ def translate(ctx, varformat, pipeline, strings, path):
if not path:
raise click.UsageError('nothing to work on. Use --help for help.')

varformats = [item for item in varformat.split(',') if item]

try:
translator = Translator(varformat.split(','), pipeline.split(','))
translator = Translator(varformats, pipeline.split(','))
except InvalidPipeline as ipe:
raise click.UsageError(ipe.args[0])

Expand Down

0 comments on commit e9e0340

Please sign in to comment.