summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md13
-rw-r--r--dist/girok-0.1.14-py3-none-any.whl (renamed from dist/girok-0.1.13-py3-none-any.whl)bin22890180 -> 22890573 bytes
-rw-r--r--dist/girok-0.1.14.tar.gz (renamed from dist/girok-0.1.13.tar.gz)bin22885239 -> 22885930 bytes
-rw-r--r--girok/__init__.py2
-rw-r--r--girok/commands/calendar.py4
-rw-r--r--girok/commands/task.py89
-rw-r--r--girok/config.json2
-rw-r--r--processreq.py8
-rw-r--r--pyproject.toml4
9 files changed, 98 insertions, 24 deletions
diff --git a/README.md b/README.md
index 9167bdc..bac9270 100644
--- a/README.md
+++ b/README.md
@@ -18,7 +18,10 @@ If you find it useful, consider supporting to help the development process! As I
[!["Buy Me A Coffee"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/changjin97z)
-# 🤖 Version `0.1.13` is released now!
+# 🤖 Version `0.1.14` is released now!
+
+1. `-y/--yes` option - don't show confirmation message
+2. Extended deadline options for `chdate` command - fully compatible with `addtask` command.
To see the current version, enter `girok --version`.
@@ -514,8 +517,10 @@ girok showtask [-T | --tag <tag name>]
To complete(delete) a task, provide the `done` command followed by the task ID.
+Optionally, you can pass `-y` or `--yes` flag if you don't want to see the confirmation message.
+
```
-girok done <task ID>
+girok done <task ID> [-y | --yes]
```
**[IMPORTANT]** The **TASK ID** is the IDs you can see when you perform `showtask` operations. Note that the **ONLY the Task IDs of the LATEST showtask operation are valid**. In other words, if you consecutively type `girok showtask` and `girok showtask -p 5` but try to delete a task with the task IDs shown in the table of the first `girok showtask` command, you might delete an unexpected task!!
@@ -539,9 +544,11 @@ Notice that the task is now striked out.
To change the date of an existing task, enter the following command.
```bash
-girok chdate <taskID> <yyyy/mm/dd | mm/dd>
+girok chdate <taskID> <Deadline options>
```
+The deadline option group is the same as `addtask` command.
+
### 5.5 `chpri` command <a name="chpricommand"></a>
To change the priority of an existing task, enter the following command.
diff --git a/dist/girok-0.1.13-py3-none-any.whl b/dist/girok-0.1.14-py3-none-any.whl
index 3aebd1f..03557b3 100644
--- a/dist/girok-0.1.13-py3-none-any.whl
+++ b/dist/girok-0.1.14-py3-none-any.whl
Binary files differ
diff --git a/dist/girok-0.1.13.tar.gz b/dist/girok-0.1.14.tar.gz
index d292af7..7a178cb 100644
--- a/dist/girok-0.1.13.tar.gz
+++ b/dist/girok-0.1.14.tar.gz
Binary files differ
diff --git a/girok/__init__.py b/girok/__init__.py
index 3cb7d95..fb69db9 100644
--- a/girok/__init__.py
+++ b/girok/__init__.py
@@ -1 +1 @@
-__version__ = "0.1.13"
+__version__ = "0.1.14"
diff --git a/girok/commands/calendar.py b/girok/commands/calendar.py
index 69f1255..6eb4c92 100644
--- a/girok/commands/calendar.py
+++ b/girok/commands/calendar.py
@@ -5,6 +5,6 @@ app = typer.Typer(rich_markup_mode='rich')
@app.command("cal", help="[green]Open Calendar GUI[/green]", rich_help_panel=":tear-off_calendar: [bold yellow1]Calendar Commands[/bold yellow1]")
def show_calendar():
- app = calendar_main.Entry()
- app.run()
+ cal_app = calendar_main.Entry()
+ cal_app.run()
diff --git a/girok/commands/task.py b/girok/commands/task.py
index 5ba02ba..9534d97 100644
--- a/girok/commands/task.py
+++ b/girok/commands/task.py
@@ -76,11 +76,24 @@ def TaskViewMutuallyExclusiveGroup(size=2):
return value
return callback
+
+def ChangeTaskDateMutuallyExclusiveGroup(size=2):
+ group = set()
+ def callback(ctx: typer.Context, param: typer.CallbackParam, value: str):
+ # Add cli option to group if it was called with a value
+ if value is not None and param.name not in group:
+ group.add(param.name)
+ if len(group) > size - 1:
+ raise typer.BadParameter(f"{param.name} is mutually exclusive with {group.pop()}")
+ return value
+ return callback
+
add_task_date_exclusivity_callback = AddTaskDateMutuallyExclusiveGroup()
time_exclusivity_callback = TimeMutuallyExclusiveGroup()
show_task_date_exclusivity_callback = ShowTaskDateMutuallyExclusiveGroup()
task_view_exclusivity_callback = TaskViewMutuallyExclusiveGroup()
+change_task_date_exclusivity_callback = ChangeTaskDateMutuallyExclusiveGroup()
###################################################################################
@@ -117,6 +130,8 @@ def full_date_callback(ctx: typer.Context, param: typer.CallbackParam, value: st
add_task_date_exclusivity_callback(ctx, param, value)
elif command_name == "showtask":
show_task_date_exclusivity_callback(ctx, param, value)
+ elif command_name == "chdate":
+ change_task_date_exclusivity_callback(ctx, param, value)
if value is None:
return None
@@ -173,7 +188,11 @@ def all_day_callback(ctx: typer.Context, param: typer.CallbackParam, value: bool
def after_callback(ctx: typer.Context, param: typer.CallbackParam, value: int):
- add_task_date_exclusivity_callback(ctx, param, value)
+ command_name = ctx.command.name
+ if command_name == 'addtask':
+ add_task_date_exclusivity_callback(ctx, param, value)
+ elif command_name == 'chdate':
+ change_task_date_exclusivity_callback(ctx, param, value)
if value is None:
return None
@@ -473,7 +492,10 @@ def show_task(
@app.command("done", help="[red]Delete[/red] a task", rich_help_panel=":fire: [bold yellow1]Task Commands[/bold yellow1]")
-def remove_task(task_id: int = typer.Argument(..., help="[yellow]Task ID[/yellow] to be deleted")):
+def remove_task(
+ task_id: int = typer.Argument(..., help="[yellow]Task ID[/yellow] to be deleted"),
+ force: bool = typer.Option(False, '-y', '--yes', help="Don't show the confirmation message")
+ ):
task_ids_cache = general_utils.read_task_ids_cache(cfg=cfg)
if str(task_id) not in task_ids_cache:
display_utils.center_print("Task ID not found.", type="error")
@@ -485,9 +507,10 @@ def remove_task(task_id: int = typer.Argument(..., help="[yellow]Task ID[/yellow
tasks_resp = task_api.get_tasks()
tasks = general_utils.bytes2dict(tasks_resp.content)['tasks']
- done_confirm = typer.confirm(f"Are you sure to delete task [{target_task_name}]?")
- if not done_confirm:
- exit(0)
+ if not force:
+ done_confirm = typer.confirm(f"Are you sure to delete task [{target_task_name}]?")
+ if not done_confirm:
+ exit(0)
resp = task_api.remove_task(target_task_id)
if resp.status_code == 204:
@@ -527,13 +550,65 @@ def change_tag(
def change_date(
task_id: int = typer.Argument(..., help="[yellow]Task ID[/yellow]"),
deadline: str = typer.Option(None, "-d", "--deadline", help="[yellow]Deadline[/yellow]", callback=full_date_callback),
- time: str = typer.Option(None, "-t", "--time", help="[yellow]Deadline time, xx:yy[/yellow]", callback=time_callback)
+ today: bool = typer.Option(None, "--tdy", help="Set deadline to [yellow]today[/yellow]", callback=change_task_date_exclusivity_callback),
+ tomorrow: bool = typer.Option(None, "--tmr", "--tomorrow", help="Set deadline to [yellow]tomorrow[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_mon: bool = typer.Option(None, "-t1", "--thismon", help="Set deadline to this [yellow]Monday[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_tue: bool = typer.Option(None, "-t2", "--thistue", help="Set deadline to this [yellow]Tuesday[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_wed: bool = typer.Option(None, "-t3", "--thiswed", help="Set deadline to, this [yellow]Wednesday[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_thu: bool = typer.Option(None, "-t4", "--thisthu", help="Set deadline to this [yellow]Thursday[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_fri: bool = typer.Option(None, "-t5", "--thisfri", help="Set deadline to this [yellow]Friday[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_sat: bool = typer.Option(None, "-t6", "--thissat", help="Set deadline to this [yellow]Saturday[/yellow]", callback=change_task_date_exclusivity_callback),
+ this_sun: bool = typer.Option(None, "-t7", "--thissun", help="Set deadline to this [yellow]Sunday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_mon: bool = typer.Option(None, "-n1", "--nextmon", help="Set deadline to next [yellow]Monday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_tue: bool = typer.Option(None, "-n2", "--nexttue", help="Set deadline to next [yellow]Tuesday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_wed: bool = typer.Option(None, "-n3", "--nextwed", help="Set deadline to next [yellow]Wednesday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_thu: bool = typer.Option(None, "-n4", "--nextthu", help="Set deadline to next [yellow]Thursday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_fri: bool = typer.Option(None, "-n5", "--nextfri", help="Set deadline to next [yellow]Friday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_sat: bool = typer.Option(None, "-n6", "--nextsat", help="Set deadline to next [yellow]Saturday[/yellow]", callback=change_task_date_exclusivity_callback),
+ next_sun: bool = typer.Option(None, "-n7", "--nextsun", help="Set deadline to next [yellow]Sunday[/yellow]", callback=change_task_date_exclusivity_callback),
+ after: int = typer.Option(None, "-a", "--after", help="Set deadline to [yellow]after x days[/yellow]", callback=after_callback),
+ time: str = typer.Option(None, "-t", "--time", help="Deadline [yellow]time, xx:yy[/yellow]", callback=time_callback),
):
+ # Deadline
+ this_week_group = [this_mon, this_tue, this_wed, this_thu, this_fri, this_sat, this_sun]
+ next_week_group = [next_mon, next_tue, next_wed, next_thu, next_fri, next_sat, next_sun]
+
+ if not any(this_week_group + next_week_group + [deadline, today, tomorrow, after]):
+ raise typer.BadParameter("At least one of deadline options is required.")
+
year, month, day = None, None, None
if deadline:
year, month, day = deadline
+
+ if today:
+ year, month, day = task_utils.get_date_from_shortcut(True, datetime.now().weekday())
+
+ if tomorrow:
+ is_this_week = True
+ weekday_num = datetime.now().weekday() + 1
+ if weekday_num == 6:
+ is_this_week = False
+ weekday_num = 0
+ year, month, day = task_utils.get_date_from_shortcut(is_this_week, weekday_num)
+
+ if after:
+ year, month, day = task_utils.get_date_from_offset(after)
+
+ if any(this_week_group):
+ this_week_day_num = [idx for idx, val in enumerate(this_week_group) if val][0]
+ year, month, day = task_utils.get_date_from_shortcut(
+ this_week=True,
+ weekday_num=this_week_day_num
+ )
+
+ if any(next_week_group):
+ this_week_day_num = [idx for idx, val in enumerate(next_week_group) if val][0]
+ year, month, day = task_utils.get_date_from_shortcut(
+ this_week=False,
+ weekday_num=this_week_day_num
+ )
+
full_deadline = f"{year}-{month}-{day} {time if time else '12:00:00'}"
-
task_ids_cache = general_utils.read_task_ids_cache(cfg=cfg)
target_task_id = task_ids_cache[str(task_id)]
task_api.change_task_date(target_task_id, full_deadline)
diff --git a/girok/config.json b/girok/config.json
index 0e667eb..2b59e3d 100644
--- a/girok/config.json
+++ b/girok/config.json
@@ -1,5 +1,5 @@
{
"app_name": "girok",
"base_url": "http://girok-server-balancer-1565927748.ap-northeast-1.elb.amazonaws.com",
- "version": "0.1.13"
+ "version": "0.1.14"
}
diff --git a/processreq.py b/processreq.py
index 6fffa06..418dc88 100644
--- a/processreq.py
+++ b/processreq.py
@@ -1,6 +1,4 @@
-import os
file_path = "requirements.txt"
-
poetry_requirements_path = "new_requirements.txt"
new_requirements = ''
@@ -13,10 +11,4 @@ with open(file_path, 'r') as f:
new_line = name + f"=\"{version}\""
with open(poetry_requirements_path, "a") as ft:
ft.write(new_line + "\n")
- # new_requirements += line + "\n"
-
-# with open(poetry_requirements_path, "w") as f:
-# f.write(new_requirements)
-
-
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 126029a..dc6a792 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,7 @@
[tool.poetry]
name = "girok"
-version = "0.1.13"
-description = "Email verification feature"
+version = "0.1.14"
+description = "Deadline options for chdate command. --yes option for done command"
authors = ["Jason Lee <changjin9792@gmail.com>"]
readme = "README.md"