File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,7 @@ Commands:
7171 download Download last version of Mergin Maps project
7272 download-file Download project file at specified version.
7373 list-projects List projects on the server
74+ list-files List files in a project
7475 login Login to the service and see how to set the token...
7576 pull Fetch changes from Mergin Maps repository
7677 push Upload local changes into Mergin Maps repository
Original file line number Diff line number Diff line change @@ -661,6 +661,27 @@ def reset(ctx):
661661 except Exception as e :
662662 _print_unhandled_exception ()
663663
664+ @cli .command ()
665+ @click .argument ("project" )
666+ @click .option ("--json" , is_flag = True , default = False , help = "Output in JSON format" )
667+ @click .pass_context
668+ def list_files (ctx , project , json ):
669+ """List files in a project."""
670+
671+ mc = ctx .obj ["client" ]
672+ if mc is None :
673+ return
674+
675+ project_info = mc .project_info (project )
676+ project_files = project_info ["files" ]
677+
678+ if json :
679+ print (project_files )
680+ else :
681+ click .echo ("Fetched {} files ." .format (len (project_files )))
682+ for file in project_files :
683+ click .echo (" {:40}\t {:6.1f} MB" .format (file ['path' ], file ["size" ] / (1024 * 1024 )))
684+
664685
665686if __name__ == "__main__" :
666687 cli ()
You can’t perform that action at this time.
0 commit comments