File tree 4 files changed +19
-0
lines changed
4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 36
36
type = str ,
37
37
help = 'Extra partitions to extract' ,
38
38
)
39
+ parser .add_argument (
40
+ '--all' ,
41
+ action = 'store_true' ,
42
+ help = 'Extract all files from archive' ,
43
+ )
39
44
40
45
parser .add_argument (
41
46
'source' ,
54
59
ctx = ExtractCtx (
55
60
keep_dump = True ,
56
61
extract_partitions = extract_partitions ,
62
+ extract_all = args .all ,
57
63
)
58
64
59
65
with get_dump_dir (args .source , ctx ) as dump_dir :
Original file line number Diff line number Diff line change 13
13
parser = argparse .ArgumentParser (description = 'Extract utils' )
14
14
15
15
group = parser .add_mutually_exclusive_group ()
16
+ group .add_argument (
17
+ '--extract-all' ,
18
+ action = 'store_true' ,
19
+ help = 'Extract all files from archive' ,
20
+ )
16
21
group .add_argument (
17
22
'--only-common' ,
18
23
action = 'store_true' ,
@@ -87,6 +92,7 @@ class ArgsSource(str, Enum):
87
92
class Args :
88
93
def __init__ (self , args : argparse .Namespace ):
89
94
# Wrap to provide type hints
95
+ self .extract_all : bool = args .extract_all
90
96
self .only_common : bool = args .only_common
91
97
self .only_target : bool = args .only_target
92
98
self .extract_factory : bool = args .extract_factory
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ def __init__(
64
64
firmware_partitions : Optional [List [str ]] = None ,
65
65
firmware_files : Optional [List [str ]] = None ,
66
66
factory_files : Optional [List [str ]] = None ,
67
+ extract_all = False ,
67
68
):
68
69
if extract_fns is None :
69
70
extract_fns = {}
@@ -90,6 +91,8 @@ def __init__(
90
91
self .factory_files = factory_files
91
92
self .extra_files : List [str ] = []
92
93
94
+ self .extract_all = extract_all
95
+
93
96
94
97
def file_name_to_partition (file_name : str ):
95
98
return file_name .split ('.' , 1 )[0 ]
@@ -238,6 +241,9 @@ def filter_extract_file_paths(
238
241
ctx : ExtractCtx ,
239
242
file_paths : List [str ],
240
243
):
244
+ if ctx .extract_all :
245
+ return file_paths
246
+
241
247
return filter_files (
242
248
[
243
249
ctx .extract_partitions ,
Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ def run(self):
164
164
list (firmware_partitions ),
165
165
list (firmware_files ),
166
166
list (factory_files ),
167
+ self .__args .extract_all ,
167
168
)
168
169
169
170
with create_source (self .__args .source , extract_ctx ) as source :
You can’t perform that action at this time.
0 commit comments