Skip to content

Commit

Permalink
Ensure project is not empty when starting a new frame
Browse files Browse the repository at this point in the history
  • Loading branch information
hiiwave authored and jmaupetit committed Oct 1, 2019
1 parent 9722846 commit 4dc7e23
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions watson/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions watson/watson.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 4dc7e23

Please sign in to comment.