#NEWLINE# def _get_parser( self ) : #NEWLINE# #INDENT# parser = argparse . ArgumentParser ( description = 'A command line tool for working with artifacts' ) #NEWLINE# subparsers = parser . add_subparsers ( ) #NEWLINE# subparser = subparsers . add_parser ( 'upload' , help = 'Uploads an artifact to repository, can detect name and version from filename' ) #NEWLINE# subparser . add_argument ( '-s' , '--staging' , action = 'store_true' , default = False , help = 'Uploads to a newly created staging repository which targets given repository' ) #NEWLINE# subparser . add_argument ( '-x' , '--use-existing' , action = 'store_true' , default = False , help = "To be used with -s, doesn't create a new repo, but uploads directly to an existingstaging repo" ) #NEWLINE# subparser . add_argument ( '--upload-filelist' , action = 'store_true' , default = False , help = 'uploads list of uploaded files' ) #NEWLINE# subparser . add_argument ( '--artifact' , help = 'name of artifact, if omitted, will be detected from filename' ) #NEWLINE# subparser . add_argument ( '--version' , help = 'version of artifact, if omitted, will be detected from filename' ) #NEWLINE# subparser . add_argument ( '-d' , '--description' , dest = 'description' , default = 'No description' , help = 'Description of a staging repository' ) #NEWLINE# subparser . add_argument ( 'local_file' , help = 'path to an artifact on your machine' ) #NEWLINE# subparser . add_argument ( 'repo_id' , help = 'id of target repository' ) #NEWLINE# subparser . add_argument ( 'group' , help = 'artifact group' ) #NEWLINE# subparser . set_defaults ( func = self . upload ) #NEWLINE# subparser = subparsers . add_parser ( 'delete' , help = 'Deletes an artifact from repository' ) #NEWLINE# subparser . add_argument ( 'url' , help = 'URL of the artifact' ) #NEWLINE# subparser . set_defaults ( func = self . delete ) #NEWLINE# subparser = subparsers . add_parser ( 'get-metadata' , help = "Prints artifact's metadata" ) #NEWLINE# subparser . add_argument ( 'repo_id' , help = 'id of repository containing the artifact' ) #NEWLINE# subparser . add_argument ( 'coordinates' , help = 'group:artifact:version[:classifier[:extension]]' ) #NEWLINE# subparser . set_defaults ( func = self . get_metadata ) #NEWLINE# subparser = subparsers . add_parser ( 'set-metadata' , help = "Sets artifact's metadata" ) #NEWLINE# subparser . add_argument ( 'metadata' , help = 'Dict in JSON format. All keys and values have to be strings,e.g. \'{"key1":"value1","key2":"value2"}\'' ) #NEWLINE# subparser . add_argument ( 'repo_id' , help = 'id of repository containing the artifact' ) #NEWLINE# subparser . add_argument ( 'coordinates' , help = 'group:artifact:version[:classifier[:extension]]' , nargs = '+' ) #NEWLINE# subparser . set_defaults ( func = self . set_metadata ) #NEWLINE# subparser = subparsers . add_parser ( 'resolve' , help = "Resolves artifacts' URLs" ) #NEWLINE# subparser . add_argument ( 'repo_id' , help = 'id of repository containing the artifact' ) #NEWLINE# subparser . add_argument ( 'coordinates' , help = 'group:artifact:version[:classifier[:extension]]' , nargs = '+' ) #NEWLINE# subparser . set_defaults ( func = self . resolve ) #NEWLINE# return parser