Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ If not all TODOs are marked, this PR is considered WIP (work in progress)
- [ ] Have **tests** been written for the new code? If you're fixing a bug, write a regression test (or have a really good reason for not writing one... and I mean **really** good!)
- [ ] Has documentation been written/updated?
- [ ] New dependencies (if any) added to requirements file
- [ ] Add an entry to CHANGELOG.rst

## Reviewer guidance

Expand Down
14 changes: 11 additions & 3 deletions kalitectl.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,18 @@
import cherrypy

# We do not understand --option value, only --option=value.
# Match all patterns of "--option value" and fail if they exist
__validate_cmd_options = re.compile(r"--?[^\s]+\s+(?:(?!--|-[\w]))")
# Similarly, we don't understand -o Foo, only -oFoo
# Match all patterns as above and fail if they exist
# With single-dash options, there's a corner case if a dash appears in a positional argument, like so:
# kalite manage retrievecontentpack local es-ES foo.zip
# Be sure to match whitespace *before* the option starts, so that dashes *inside* arguments are okay!
# (?!...) is a negative lookahead assertion. It only matches if the ... pattern *isn't* found!
__validate_cmd_options = re.compile(r"\s--?[^\s]+\s+(?!--|-[\w])")
if __validate_cmd_options.search(" ".join(sys.argv[1:])):
sys.stderr.write("Please only use --option=value or -x123 patterns. No spaces allowed between option and value. The option parser gets confused if you do otherwise.\n\nWill be fixed in a future release.")
sys.stderr.write("Please only use --option=value or -x123 patterns. No spaces allowed between option and value. "
"The option parser gets confused if you do otherwise."
"\nAdditionally, please put all Django management command options *after* positional arguments."
"\n\nWill be fixed in a future release.")
sys.exit(1)

from threading import Thread
Expand Down