diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e4f84e2..e1b6ba13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Stylize prompt to create new project or tag (#310). - Aggregate calculates wrong time if used with `--current` (#293) +- The `start` command now correctly checks if project is empty (#322) ## [1.8.0] - 2019-08-26 diff --git a/watson/cli.py b/watson/cli.py index 260d8724..daf368cf 100644 --- a/watson/cli.py +++ b/watson/cli.py @@ -205,6 +205,8 @@ def start(ctx, watson, confirm_new_project, confirm_new_tag, args, gap_=True): project = ' '.join( itertools.takewhile(lambda s: not s.startswith('+'), args) ) + if not project: + raise click.ClickException("No project given.") # Confirm creation of new project if that option is set if (watson.config.getboolean('options', 'confirm_new_project') or @@ -1143,6 +1145,8 @@ def add(watson, args, from_, to, confirm_new_project, confirm_new_tag): project = ' '.join( itertools.takewhile(lambda s: not s.startswith('+'), args) ) + if not project: + raise click.ClickException("No project given.") # Confirm creation of new project if that option is set if (watson.config.getboolean('options', 'confirm_new_project') or diff --git a/watson/watson.py b/watson/watson.py index df7cc00f..9077c888 100644 --- a/watson/watson.py +++ b/watson/watson.py @@ -252,9 +252,6 @@ def add(self, project, from_date, to_date, tags): return frame def start(self, project, tags=None, restart=False, gap=True): - if not project: - raise WatsonError("No project given.") - if self.is_started: raise WatsonError( u"Project {} is already started.".format(