Skip to content

Commit

Permalink
Run a fixed sequence of commands unless a shell is requested.
Browse files Browse the repository at this point in the history
  • Loading branch information
reinhardt committed Jul 8, 2020
1 parent 7593f56 commit 54c7345
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ Relative dates are supported as well, e.g. for the day before yesterday

octodon --date=-2

There is a simple command-line interface. The most important commands are *edit*, which lets you review and modify the time tracking data, and *book*, which writes it to the configured target(s) (e.g. harvest).
For a simple command-line interface run

::

octodon shell

The most important commands are *edit*, which lets you review and modify the time tracking data, and *book*, which writes it to the configured target(s) (e.g. harvest). Type *help* to get a list of commands.

VIM PLUGIN
----------
Expand Down
9 changes: 7 additions & 2 deletions src/octodon/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,8 @@ def check_issue_and_comment(self, bookings):
"\n{0}".format(make_table(rows)),
file=sys.stderr,
)
return False
return True

def print_summary(self, bookings):
total_time = get_time_sum(bookings)
Expand Down Expand Up @@ -388,7 +390,8 @@ def do_edit(self, *args):
if retval.returncode:
print("Warning: The editor reported a problem ({})".format(retval))
self.clear_bookings()
self.check_issue_and_comment(self.bookings)
if not self.check_issue_and_comment(self.bookings):
self.cmdqueue.clear()

def do_redmine(self, *args):
""" Write current bookings to redmine. """
Expand Down Expand Up @@ -532,9 +535,11 @@ def main():
else:
raise Exception("unrecognized date format: {0}".format(args.date))

if args.command:
if args.command and args.command != "shell":
octodon = Octodon(config, spent_on, new_session=True)
octodon.onecmd(args.command)
else:
octodon = Octodon(config, spent_on, new_session=args.new_session)
if args.command != "shell":
octodon.cmdqueue.extend(["edit", "summary", "book", "list save"])
octodon.cmdloop()

0 comments on commit 54c7345

Please sign in to comment.