|
6 | 6 | import click |
7 | 7 |
|
8 | 8 | from .base import ChoiceList, IntColonInt, instance_option, map_to_click_exceptions |
| 9 | +from ..consts import SyncMode |
9 | 10 | from ..dandiarchive import _dandi_url_parser, parse_dandi_url |
10 | 11 | from ..dandiset import Dandiset |
11 | 12 | from ..download import DownloadExisting, DownloadFormat, PathType |
|
116 | 117 | ), |
117 | 118 | ) |
118 | 119 | @click.option( |
119 | | - "--sync", is_flag=True, help="Delete local assets that do not exist on the server" |
120 | | -) |
121 | | -@click.option( |
122 | | - "-y", |
123 | | - "--yes", |
124 | | - is_flag=True, |
125 | | - help="Automatically confirm yes to any prompts (e.g., deletion with --sync)", |
| 120 | + "--sync", |
| 121 | + is_flag=False, |
| 122 | + flag_value="ask", |
| 123 | + default=None, |
| 124 | + type=click.Choice(list(SyncMode)), |
| 125 | + help="Delete local assets that do not exist on the server. " |
| 126 | + "With 'ask' (the default when --sync is passed without a value), prompt before " |
| 127 | + "deleting. With 'do', delete without prompting.", |
126 | 128 | ) |
127 | 129 | @instance_option( |
128 | 130 | default=None, |
@@ -156,8 +158,7 @@ def download( |
156 | 158 | jobs: tuple[int, int], |
157 | 159 | format: DownloadFormat, |
158 | 160 | download_types: set[str], |
159 | | - sync: bool, |
160 | | - yes: bool, |
| 161 | + sync: str | None, |
161 | 162 | dandi_instance: str, |
162 | 163 | path_type: PathType, |
163 | 164 | preserve_tree: bool, |
@@ -197,8 +198,7 @@ def download( |
197 | 198 | get_metadata="dandiset.yaml" in download_types or preserve_tree, |
198 | 199 | get_assets="assets" in download_types or preserve_tree, |
199 | 200 | preserve_tree=preserve_tree, |
200 | | - sync=sync, |
201 | | - yes=yes, |
| 201 | + sync=SyncMode(sync) if sync is not None else None, |
202 | 202 | path_type=path_type, |
203 | 203 | # develop_debug=develop_debug |
204 | 204 | ) |
0 commit comments