Created
May 31, 2022 14:44
-
-
Save liuzheng1990/4338a3e3243a98d8115fbb998c43ec2d to your computer and use it in GitHub Desktop.
Revisions
-
liuzheng1990 created this gist
May 31, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ """ The command-line interface for the downloader """ import argparse from .downloader import download def main(): parser = argparse.ArgumentParser( description="An over-simplified downloader to demonstrate python packaging." ) parser.add_argument( "url", type=str, help="The URL of the resource to be downloaded." ) parser.add_argument( "--output", "-o", help=("Destination local file path. If not set, the resource " "will be downloaded to the current working directory, with filename " "same as the basename of the URL") ) args = parser.parse_args() file_size = download(args.url, dest_path=args.output) print("Download successful! (size: {} B)".format(file_size)) if __name__ == "__main__": main()