Add story state commands
This commit is contained in:
parent
44f7e57ae1
commit
9beae26d0d
|
@ -174,19 +174,32 @@ def _set_story_state(story: str, state: str) -> None:
|
||||||
api.stories.put_story(token, story_id, current_state=state)
|
api.stories.put_story(token, story_id, current_state=state)
|
||||||
|
|
||||||
|
|
||||||
|
def _complete_projects(ctx: click.Context, args: List[str], incomplete: str) \
|
||||||
|
-> List[str]:
|
||||||
|
return [alias for alias in Config['project_aliases']
|
||||||
|
if alias.startswith(incomplete)]
|
||||||
|
|
||||||
@cli.command('stories')
|
@cli.command('stories')
|
||||||
@click.argument('project')
|
@click.argument(
|
||||||
|
'project', type=click.STRING, autocompletion=_complete_projects)
|
||||||
@click.argument('story', required=False)
|
@click.argument('story', required=False)
|
||||||
|
@click.argument('action', required=False)
|
||||||
@click.option('--scope', default='current')
|
@click.option('--scope', default='current')
|
||||||
@click.option('--show-accepted/--hide-accepted', default=True)
|
@click.option('--show-accepted/--hide-accepted', default=True)
|
||||||
@click.option('--set-state', type=click.Choice([
|
@click.option('--set-state', type=click.Choice(STATES))
|
||||||
'planned', 'started', 'finished', 'delivered', 'rejected', 'accepted']))
|
|
||||||
@require_login
|
@require_login
|
||||||
def stories(project: str, story: Optional[str], scope: str,
|
def stories(project: str, story: Optional[str], action: Optional[str],
|
||||||
show_accepted: bool, set_state: str) -> None:
|
scope: str, show_accepted: bool, set_state: str) -> None:
|
||||||
if story is not None:
|
if story is not None:
|
||||||
|
state_actions = 'start', 'finish', 'deliver', 'accept', 'reject'
|
||||||
if set_state is not None:
|
if set_state is not None:
|
||||||
_set_story_state(story, set_state)
|
_set_story_state(story, set_state)
|
||||||
|
elif action is not None:
|
||||||
|
if action in state_actions:
|
||||||
|
_set_story_state(story, f"{action}ed")
|
||||||
|
if action == "comment":
|
||||||
|
# todo
|
||||||
|
pass
|
||||||
|
|
||||||
stories_info(story)
|
stories_info(story)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,38 +1,8 @@
|
||||||
click==6.7
|
|
||||||
appnope==0.1.0
|
appnope==0.1.0
|
||||||
astroid==1.6.1
|
astroid==1.6.1
|
||||||
autopep8==1.3.4
|
autopep8==1.3.4
|
||||||
base32-crockford==0.3.0
|
base32-crockford==0.3.0
|
||||||
beeprint==2.4.7
|
click-fish==0.1.0
|
||||||
certifi==2018.1.18
|
click==7.0
|
||||||
chardet==3.0.4
|
|
||||||
decorator==4.2.1
|
|
||||||
flake8==3.5.0
|
|
||||||
idna==2.6
|
|
||||||
ipython==6.2.1
|
|
||||||
ipython-genutils==0.2.0
|
|
||||||
isort==4.3.4
|
|
||||||
jedi==0.11.1
|
|
||||||
lazy-object-proxy==1.3.1
|
|
||||||
mccabe==0.6.1
|
|
||||||
mypy==0.570
|
|
||||||
parso==0.1.1
|
|
||||||
pexpect==4.4.0
|
|
||||||
pickleshare==0.7.4
|
|
||||||
prompt-toolkit==1.0.15
|
|
||||||
ptyprocess==0.5.2
|
|
||||||
pycodestyle==2.3.1
|
|
||||||
pyflakes==1.6.0
|
|
||||||
Pygments==2.2.0
|
|
||||||
pylint==1.8.2
|
|
||||||
requests==2.18.4
|
requests==2.18.4
|
||||||
rope==0.10.7
|
|
||||||
simplegeneric==0.8.1
|
|
||||||
six==1.11.0
|
|
||||||
tabulate==0.8.2
|
tabulate==0.8.2
|
||||||
traitlets==4.3.2
|
|
||||||
typed-ast==1.1.0
|
|
||||||
urllib3==1.22
|
|
||||||
urwid==2.0.1
|
|
||||||
wcwidth==0.1.7
|
|
||||||
wrapt==1.10.11
|
|
||||||
|
|
Loading…
Reference in New Issue