Skip to content

Commit ab3fd1e

Browse files
committed
Don't expose the list_resolution_strategies option to the apps. nit: End all click option help strings with a dot for consistency
1 parent a0f5eaf commit ab3fd1e

File tree

8 files changed

+45
-54
lines changed

8 files changed

+45
-54
lines changed

syncall/cli.py

Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def _opt_pdb_on_error():
3535
"--pdb-on-error",
3636
"pdb_on_error",
3737
is_flag=True,
38-
help="Invoke PDB if there's an uncaught exception during the program execution",
38+
help="Invoke PDB if there's an uncaught exception during the program execution.",
3939
callback=_set_own_excepthook,
4040
expose_value=True,
4141
is_eager=True,
@@ -163,7 +163,7 @@ def _opt_tw_filter():
163163
type=str,
164164
help=(
165165
"Taskwarrior filter for specifying the tasks to synchronize. These filters will be"
166-
" concatenated using OR with potential tags and projects potentially specified"
166+
" concatenated using OR with potential tags and projects potentially specified."
167167
),
168168
)
169169

@@ -174,7 +174,7 @@ def _opt_tw_all_tasks():
174174
"--taskwarrior-all-tasks",
175175
"tw_sync_all_tasks",
176176
is_flag=True,
177-
help="Sync all taskwarrior tasks (potentially very slow)",
177+
help="Sync all taskwarrior tasks (potentially very slow).",
178178
)
179179

180180

@@ -184,7 +184,7 @@ def _opt_tw_tags():
184184
"--taskwarrior-tags",
185185
"tw_tags",
186186
type=str,
187-
help="Taskwarrior tags to synchronize",
187+
help="Taskwarrior tags to synchronize.",
188188
expose_value=True,
189189
multiple=True,
190190
)
@@ -196,7 +196,7 @@ def _opt_tw_project():
196196
"--tw-project",
197197
"tw_project",
198198
type=str,
199-
help="Taskwarrior project to synchronize",
199+
help="Taskwarrior project to synchronize.",
200200
expose_value=True,
201201
is_eager=True,
202202
)
@@ -216,7 +216,7 @@ def callback(ctx, param, value):
216216
type=str,
217217
help=(
218218
"Only synchronize Taskwarrior tasks that have been modified in the last X days"
219-
" (specify X, e.g., 1, 30, 0.5, etc.)"
219+
" (specify X, e.g., 1, 30, 0.5, etc.)."
220220
),
221221
callback=callback,
222222
)
@@ -229,7 +229,7 @@ def _opt_prefer_scheduled_date():
229229
is_flag=True,
230230
help=(
231231
'Prefer using the "scheduled" date field instead of the "due" date if the former'
232-
" is available"
232+
" is available."
233233
),
234234
)
235235

@@ -241,7 +241,7 @@ def opt_notion_page_id():
241241
"--notion-page",
242242
"notion_page_id",
243243
type=str,
244-
help="Page ID of the Notion page to synchronize",
244+
help="Page ID of the Notion page to synchronize.",
245245
)
246246

247247

@@ -250,7 +250,7 @@ def opt_notion_token_pass_path():
250250
"--token",
251251
"--token-pass-path",
252252
"token_pass_path",
253-
help="Path in the UNIX password manager to fetch",
253+
help="Path in the UNIX password manager to fetch.",
254254
)
255255

256256

@@ -279,7 +279,7 @@ def _opt_gkeep_user_pass_path():
279279
"--user",
280280
"--user-pass-path",
281281
"gkeep_user_pass_path",
282-
help="Path in the UNIX password manager to fetch the Google username from",
282+
help="Path in the UNIX password manager to fetch the Google username from.",
283283
default="gkeepapi/user",
284284
)
285285

@@ -289,7 +289,7 @@ def _opt_gkeep_passwd_pass_path():
289289
"--passwd",
290290
"--passwd-pass-path",
291291
"gkeep_passwd_pass_path",
292-
help="Path in the UNIX password manager to fetch the Google password from",
292+
help="Path in the UNIX password manager to fetch the Google password from.",
293293
default="gkeepapi/passwd",
294294
)
295295

@@ -299,7 +299,7 @@ def _opt_gkeep_token_pass_path():
299299
"--token",
300300
"--token-pass-path",
301301
"gkeep_token_pass_path",
302-
help="Path in the UNIX password manager to fetch the google keep token from",
302+
help="Path in the UNIX password manager to fetch the google keep token from.",
303303
default="gkeepapi/token",
304304
)
305305

@@ -310,7 +310,7 @@ def _opt_gkeep_labels():
310310
"--gkeep-labels",
311311
type=str,
312312
multiple=True,
313-
help="Google Keep labels whose notes to synchronize",
313+
help="Google Keep labels whose notes to synchronize.",
314314
)
315315

316316

@@ -320,7 +320,7 @@ def _opt_gkeep_ignore_labels():
320320
"--gkeep-ignore-labels",
321321
type=str,
322322
multiple=True,
323-
help="Google Keep labels whose notes will be explicitly ignored",
323+
help="Google Keep labels whose notes will be explicitly ignored.",
324324
)
325325

326326

@@ -331,7 +331,7 @@ def _opt_gkeep_note():
331331
type=str,
332332
help=(
333333
"Full title of the Google Keep Note to synchronize - Make sure you enable the"
334-
" checkboxes"
334+
" checkboxes."
335335
),
336336
)
337337

@@ -342,7 +342,7 @@ def opt_gcal_calendar():
342342
"-c",
343343
"--gcal-calendar",
344344
type=str,
345-
help="Name of the Google Calendar to synchronize (will be created if not there)",
345+
help="Name of the Google Calendar to synchronize (will be created if not there).",
346346
)
347347

348348

@@ -352,7 +352,7 @@ def opt_gtasks_list():
352352
"-l",
353353
"--gtasks-list",
354354
type=str,
355-
help="Name of the Google Tasks list to synchronize (will be created if not there)",
355+
help="Name of the Google Tasks list to synchronize (will be created if not there).",
356356
)
357357

358358

@@ -362,7 +362,7 @@ def opt_google_secret_override():
362362
"--google-secret",
363363
default=None,
364364
type=click.Path(exists=True, file_okay=True, dir_okay=False, resolve_path=True),
365-
help="Override the client secret used for the communication with the Google APIs",
365+
help="Override the client secret used for the communication with the Google APIs.",
366366
)
367367

368368

@@ -371,7 +371,7 @@ def opt_google_oauth_port():
371371
"--oauth-port",
372372
default=8081,
373373
type=int,
374-
help="Port to use for OAuth Authentication with Google Applications",
374+
help="Port to use for OAuth Authentication with Google Applications.",
375375
)
376376

377377

@@ -399,15 +399,15 @@ def _opt_caldav_calendar():
399399
"--caldav-calendar",
400400
type=str,
401401
default="Personal",
402-
help="Name of the caldav Calendar to sync (will be created if not there)",
402+
help="Name of the caldav Calendar to sync (will be created if not there).",
403403
)
404404

405405

406406
def _opt_caldav_url():
407407
return click.option(
408408
"--caldav-url",
409409
type=str,
410-
help="URL where the caldav calendar is hosted at (including /dav if applicable)",
410+
help="URL where the caldav calendar is hosted at (including /dav if applicable).",
411411
)
412412

413413

@@ -424,15 +424,15 @@ def _opt_caldav_passwd_pass_path():
424424
"--caldav-passwd",
425425
"--caldav-passwd-pass-path",
426426
"caldav_passwd_pass_path",
427-
help="Path in the UNIX password manager to fetch the caldav password from",
427+
help="Path in the UNIX password manager to fetch the caldav password from.",
428428
)
429429

430430

431431
def _opt_caldav_passwd_cmd():
432432
return click.option(
433433
"--caldav-passwd-cmd",
434434
"caldav_passwd_cmd",
435-
help="Command that outputs the caldav password on stdout",
435+
help="Command that outputs the caldav password on stdout.",
436436
)
437437

438438

@@ -444,7 +444,7 @@ def opt_filesystem_root():
444444
"filesystem_root",
445445
required=False,
446446
type=str,
447-
help="Directory to consider as root for synchronization operations",
447+
help="Directory to consider as root for synchronization operations.",
448448
)
449449

450450

@@ -454,7 +454,7 @@ def opt_filename_extension():
454454
"--filename-extension",
455455
"filename_extension",
456456
type=str,
457-
help="Use this extension for locally created files",
457+
help="Use this extension for locally created files.",
458458
default=".md",
459459
)
460460

@@ -492,15 +492,12 @@ def opt_default_duration_event_mins():
492492
"default_event_duration_mins",
493493
default=30,
494494
type=int,
495-
help="The default duration of an event that is to be created [in minutes]",
495+
help="The default duration of an event that is to be created [in minutes].",
496496
)
497497

498498

499499
def _list_named_combinations(config_fname: str) -> None:
500-
"""List the named configurations currently available for the given configuration name.
501-
502-
Mainly used by the top-level synchronization apps.
503-
"""
500+
"""List the named configurations currently available for the given configuration name."""
504501
logger.success(
505502
format_list(
506503
header="\n\nNamed configurations currently available",
@@ -511,19 +508,20 @@ def _list_named_combinations(config_fname: str) -> None:
511508

512509
def _opt_list_combinations(side_A_name: str, side_B_name: str):
513510
def callback(ctx, param, value):
514-
_list_named_combinations(
515-
config_fname=determine_app_config_fname(
516-
side_A_name=side_A_name, side_B_name=side_B_name
511+
if value is True:
512+
_list_named_combinations(
513+
config_fname=determine_app_config_fname(
514+
side_A_name=side_A_name, side_B_name=side_B_name
515+
)
517516
)
518-
)
519-
sys.exit(0)
517+
sys.exit(0)
520518

521519
return click.option(
522520
"--list-combinations",
523521
"do_list_combinations",
524522
is_flag=True,
525523
expose_value=False,
526-
help=f"List the available named {side_A_name}<->{side_B_name} combinations",
524+
help=f"List the available named {side_A_name}<->{side_B_name} combinations.",
527525
callback=callback,
528526
)
529527

@@ -534,25 +532,25 @@ def _opt_resolution_strategy():
534532
"--resolution-strategy",
535533
default="AlwaysSecondRS",
536534
type=click.Choice(list(name_to_resolution_strategy_type.keys())),
537-
help="Resolution strategy to use during conflicts",
535+
help="Resolution strategy to use during conflicts.",
538536
)
539537

540538

541-
def _list_resolution_strategies(ctx, param, value):
542-
if value is not True:
543-
return
544-
545-
strs = name_to_resolution_strategy_type.keys()
546-
click.echo("\n".join([f"{a}. {b}" for a, b in zip(range(1, len(strs) + 1), strs)]))
547-
sys.exit(0)
539+
def _opt_list_resolution_strategies():
540+
def _list_resolution_strategies(ctx, param, value):
541+
if value is not True:
542+
return
548543

544+
strs = name_to_resolution_strategy_type.keys()
545+
click.echo("\n".join([f"{a}. {b}" for a, b in zip(range(1, len(strs) + 1), strs)]))
546+
sys.exit(0)
549547

550-
def _opt_list_resolution_strategies():
551548
return click.option(
552549
"--list-resolution-strategies",
553550
callback=_list_resolution_strategies,
554551
is_flag=True,
555-
help="List all the available resolution strategies and exit",
552+
expose_value=False,
553+
help="List all the available resolution strategies and exit.",
556554
)
557555

558556

@@ -562,7 +560,7 @@ def _opt_combination(side_A_name: str, side_B_name: str):
562560
COMBINATION_FLAGS[1],
563561
"combination_name",
564562
type=str,
565-
help=f"Name of an already saved {side_A_name}<->{side_B_name} combination",
563+
help=f"Name of an already saved {side_A_name}<->{side_B_name} combination.",
566564
)
567565

568566

syncall/scripts/fs_gkeep_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def main(
5656
verbose: int,
5757
combination_name: str,
5858
custom_combination_savename: str,
59-
list_resolution_strategies: bool,
6059
pdb_on_error: bool,
6160
):
6261
"""

syncall/scripts/tw_asana_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ def main(
5555
verbose: int,
5656
combination_name: str,
5757
custom_combination_savename: str,
58-
list_resolution_strategies: bool,
5958
pdb_on_error: bool,
6059
):
6160
"""Synchronize your tasks in Asana with filters from Taskwarrior."""

syncall/scripts/tw_caldav_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ def main(
5454
verbose: int,
5555
combination_name: str,
5656
custom_combination_savename: str,
57-
list_resolution_strategies: bool,
5857
pdb_on_error: bool,
5958
):
6059
"""Synchronize lists of tasks from your caldav Calendar with filters from Taskwarrior.

syncall/scripts/tw_gcal_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def main(
5959
verbose: int,
6060
combination_name: str,
6161
custom_combination_savename: str,
62-
list_resolution_strategies: bool, # type: ignore
6362
default_event_duration_mins: int,
6463
pdb_on_error: bool,
6564
):

syncall/scripts/tw_gkeep_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def main(
5151
verbose: int,
5252
combination_name: str,
5353
custom_combination_savename: str,
54-
list_resolution_strategies: bool,
5554
pdb_on_error: bool,
5655
):
5756
"""Synchronize Notes from your Google Keep with filters from Taskwarrior.

syncall/scripts/tw_gtasks_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def main(
5656
verbose: int,
5757
combination_name: str,
5858
custom_combination_savename: str,
59-
list_resolution_strategies: bool,
6059
pdb_on_error: bool,
6160
):
6261
"""Synchronize lists from your Google Tasks with filters from Taskwarrior.

syncall/scripts/tw_notion_sync.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ def main(
5959
verbose: int,
6060
combination_name: str,
6161
custom_combination_savename: str,
62-
list_resolution_strategies: bool,
6362
pdb_on_error: bool,
6463
):
6564
"""Synchronise filters of TW tasks with the to_do items of Notion pages.

0 commit comments

Comments
 (0)