Skip to content

Commit

Permalink
Issue #28: Create docs (items doc functions).
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed May 20, 2020
1 parent 66a318a commit 4741817
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
54 changes: 53 additions & 1 deletion google_keep_tasks/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,17 @@ def search_item(items, text):

@click.group()
def items():
pass
"""Notes can have multiple checkbox items. Gkeep can manage
these checkboxes using ``items`` command. This command has subcommands for adding,
editing, deleting or check/uncheck items. To see all subcommands of ``items`` use
``--help``::
gkeep items --help
An example of a subcommand is ``add``. To see help use
``gkeep items add --help``. In all ``items`` subcommands, note ``id`` argument is
mandatory. To get note ``id`` use ``gkeep notes search`` or ``gkeep notes get``.
"""


@items.command('add')
Expand All @@ -25,6 +35,16 @@ def items():
@click.argument('text')
@click.pass_context
def add_item(ctx, check, duplicate, id, text):
"""Add a item to an existing note. By default if the element already exists,
it is not duplicated. To duplicate the element use ``--duplicate`` param. By
default the item is created unchecked.
.. code-block:: shell
gkeep items add 75e4202b0c1.9fc0b868a7b34952 "Chip cookies" --check
The syntax is:
"""
keep = ctx.obj['keep']
gnote = keep.get(id)
try:
Expand All @@ -47,6 +67,22 @@ def add_item(ctx, check, duplicate, id, text):
@click.argument('text')
@click.pass_context
def edit_item(ctx, check, new_text, id, text):
"""Edit an existing item. Use this command to change the text or
check or uncheck the item. For example:
.. code-block:: shell
gkeep items edit 75e4202b0c1.9fc0b868a7b34952 "Chip cookies" --uncheck
Another example:
.. code-block:: shell
gkeep items edit 75e4202b0c1.9fc0b868a7b34952 "Chip cookies"
--new-text "Chocolate orange cookies"
The syntax is:
"""
keep = ctx.obj['keep']
gnote = keep.get(id)
item = search_item(gnote.items, text)
Expand All @@ -60,6 +96,14 @@ def edit_item(ctx, check, new_text, id, text):
@click.argument('text')
@click.pass_context
def delete_item(ctx, id, text):
"""Delete a item to an existing note.
.. code-block:: shell
gkeep items delete 75e4202b0c1.9fc0b868a7b34952 "Chip cookies"
The syntax is:
"""
keep = ctx.obj['keep']
gnote = keep.get(id)
item = search_item(gnote.items, text)
Expand All @@ -72,6 +116,14 @@ def delete_item(ctx, id, text):
@click.argument('text')
@click.pass_context
def delete_item(ctx, id, text):
"""Returns ``True`` if the item is checked and ``False`` if it is unchecked.
.. code-block:: shell
gkeep items is-checked 75e4202b0c1.9fc0b868a7b34952 "Chip cookies"
The syntax is:
"""
keep = ctx.obj['keep']
gnote = keep.get(id)
item = search_item(gnote.items, text)
Expand Down
2 changes: 1 addition & 1 deletion google_keep_tasks/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def notes():
@click.argument('text')
@click.pass_context
def add_note(ctx, color, labels, title, text):
"""Add a new note to Google Keep. Add a new note to Google Keep.
"""Add a new note to Google Keep.
A title and a message body are required for the new note. For example:
.. code-block:: shell
Expand Down

0 comments on commit 4741817

Please sign in to comment.