Skip to content

Commit

Permalink
feat(cli): support creating draft in "gas draft" command
Browse files Browse the repository at this point in the history
  • Loading branch information
rexzheng324-c committed May 16, 2021
1 parent 079878f commit 168e05e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tensorbay/cli/draft.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
import click

from .tbrn import TBRN, TBRNType
from .utility import get_dataset_client, get_gas


def _implement_draft(
obj: Dict[str, str], tbrn: str, title: str, is_list: bool # pylint: disable=unused-argument
) -> None:
gas = get_gas(**obj)
info = TBRN(tbrn=tbrn)
dataset_client = get_dataset_client(gas, info)

if info.type != TBRNType.DATASET:
click.echo(f'To operate a draft, "{info}" must be a dataset', err=True)
sys.exit(1)

if title:
pass
# todo: create draft base on revision
dataset_client.create_draft(title=title)
click.echo(f"Draft {dataset_client.status.draft_number} is created successfully")

if is_list:
pass

0 comments on commit 168e05e

Please sign in to comment.