@@ -30,30 +30,51 @@ def download(
3030 files : Optional [List [str ]] = typer .Argument (None , help = "file names, ids or patterns" ),
3131 projects : Optional [List [str ]] = typer .Option (None , "--project" , "-p" , help = "project names, ids or patterns" ),
3232 missions : Optional [List [str ]] = typer .Option (None , "--mission" , "-m" , help = "mission names, ids or patterns" ),
33- allow_corrupt_files : bool = typer .Option (
34- False ,
35- help = "allow downloading corrupted files (potentially dangerous, use with caution)" ,
36- ),
3733 dest : str = typer .Option (prompt = "destination" , help = "local path to save the files" ),
3834 nested : bool = typer .Option (False , help = "save files in nested directories, project-name/mission-name" ),
3935 overwrite : bool = typer .Option (
4036 False ,
4137 help = "overwrite files if they already exist and don't match the file size or file hash" ,
4238 ),
39+ include_corrupt_files : bool = typer .Option (
40+ False ,
41+ help = "download files marked as CORRUPTED (potentially dangerous, use with caution)" ,
42+ ),
43+ yes : bool = typer .Option (
44+ False ,
45+ "--yes" ,
46+ "-y" ,
47+ help = "skip all confirmation prompts" ,
48+ ),
49+ allow_corrupt : bool = typer .Option (
50+ False ,
51+ "--allow-corrupt" ,
52+ help = "skip confirmation prompt for downloading files marked as CORRUPTED" ,
53+ ),
54+ create_dirs : bool = typer .Option (
55+ False ,
56+ "--create-dirs" ,
57+ help = "create missing destination directories without prompting" ,
58+ ),
4359) -> None :
44- if allow_corrupt_files :
60+ if include_corrupt_files :
4561 typer .secho (
46- "Warning: --allow -corrupt-files enables downloading files marked as CORRUPTED. "
62+ "Warning: --include -corrupt-files enables downloading files marked as CORRUPTED. "
4763 "These files may be harmful. Do not execute or open them blindly." ,
4864 fg = typer .colors .YELLOW ,
4965 err = True ,
5066 )
51- typer .confirm ("Do you want to continue?" , abort = True )
67+ if not (yes or allow_corrupt ):
68+ typer .confirm ("Do you want to continue? You can use --yes or --allow-corrupt to skip this prompt." , abort = True )
5269
5370 # create destination directory
5471 dest_dir = Path (dest )
5572 if not dest_dir .exists ():
56- typer .confirm (f"Destination { dest_dir } does not exist. Create it?" , abort = True )
73+ if not (yes or create_dirs ):
74+ typer .confirm (
75+ f"Destination { dest_dir } does not exist. Create it? You can use --yes or --create-dirs to skip this prompt." ,
76+ abort = True ,
77+ )
5778 dest_dir .mkdir (parents = True , exist_ok = True )
5879
5980 # get file query
@@ -72,7 +93,7 @@ def download(
7293 kleinkram .core .download (
7394 client = AuthenticatedClient (),
7495 query = file_query ,
75- allow_corrupt_files = allow_corrupt_files ,
96+ allow_corrupt_files = include_corrupt_files ,
7697 base_dir = dest_dir ,
7798 nested = nested ,
7899 overwrite = overwrite ,
0 commit comments