get args cleanup
This commit is contained in:
		
							parent
							
								
									dc30ac33ec
								
							
						
					
					
						commit
						dcf143d556
					
				
							
								
								
									
										44
									
								
								patchodon.py
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								patchodon.py
									
									
									
									
									
								
							|  | @ -130,6 +130,11 @@ def do_post(args): | |||
| 
 | ||||
| 
 | ||||
| def do_get(args): | ||||
|     # search & resolve the status ID on the instance (if configured) | ||||
|     # get context, all replies from the same author as the original status ID | ||||
|     # cycle the same for all hashes | ||||
|     # verify the full hash | ||||
|     # pass to git-am OR throw to a directory | ||||
|     pass | ||||
| 
 | ||||
| 
 | ||||
|  | @ -142,10 +147,8 @@ def main(): | |||
| 
 | ||||
|     cmds = ap.add_subparsers(required=True, dest="command") | ||||
| 
 | ||||
|     if "POST command": | ||||
|         post = cmds.add_parser("post") | ||||
|     if "API token sources": | ||||
|             group = post.add_mutually_exclusive_group() | ||||
|         group = cmds.add_mutually_exclusive_group() | ||||
|         group.add_argument( | ||||
|             "--debug-api-token", | ||||
|             help=( | ||||
|  | @ -160,21 +163,23 @@ def main(): | |||
|             help="get the API token from environment PATCHODON_API_TOKEN", | ||||
|         ) | ||||
| 
 | ||||
|         post.add_argument( | ||||
|     cmds.add_argument( | ||||
|         "-i", | ||||
|         "--instance-url", | ||||
|         help=( | ||||
|                 "mastodon instance URL to post to, such as" | ||||
|                 " `https://mastodon.example/'" | ||||
|             "mastodon instance URL to use, such as `https://mastodon.example/'" | ||||
|         ), | ||||
|     ) | ||||
| 
 | ||||
|     if "POST command": | ||||
|         post = cmds.add_parser("post") | ||||
|         post.add_argument( | ||||
|             "-r", | ||||
|             "--recipient", | ||||
|             default=None, | ||||
|             help=( | ||||
|                 "user tag to prepend to all posted statuses (required esp. for" | ||||
|                 " direct sending of statuses))" | ||||
|                 " direct sending of statuses)" | ||||
|             ), | ||||
|         ) | ||||
|         post.add_argument( | ||||
|  | @ -182,8 +187,8 @@ def main(): | |||
|             "--subject", | ||||
|             default=None, | ||||
|             help=( | ||||
|                 "start text of the initial post (e.g. to @tag someone and name" | ||||
|                 " the project and topic)" | ||||
|                 "opening text of the initial post, ideally used to specify the" | ||||
|                 " target project and patch topic" | ||||
|             ), | ||||
|         ) | ||||
|         post.add_argument( | ||||
|  | @ -209,7 +214,8 @@ def main(): | |||
|             group = get.add_mutually_exclusive_group() | ||||
|             group.add_argument( | ||||
|                 "-a", | ||||
|                 "--am", | ||||
|                 "--run-git-am", | ||||
|                 action="store_true", | ||||
|                 help=( | ||||
|                     "apply the patches immediately with git-am instead of" | ||||
|                     " storing them in a directory" | ||||
|  | @ -217,25 +223,29 @@ def main(): | |||
|             ) | ||||
|             group.add_argument( | ||||
|                 "-C", | ||||
|                 "--out-dir", | ||||
|                 "--out-prefix", | ||||
|                 default="./patchodon-", | ||||
|                 help=( | ||||
|                     "output the patches into a given directory (by default, `.'" | ||||
|                     "write the numbered patchfiles to files with a given prefix" | ||||
|                     " (the default `./patchodon-' will produce files like" | ||||
|                     " `./patchodon-0001.patch')" | ||||
|                 ), | ||||
|             ) | ||||
|             get.add_argument( | ||||
|                 "--overwrite", | ||||
|                 action="store_true", | ||||
|                 help="overwrite existing patch files instead of renaming", | ||||
|                 help="overwrite existing patch files instead of failing", | ||||
|             ) | ||||
| 
 | ||||
|     ap.add_argument( | ||||
|         "-c", | ||||
|         "--config", | ||||
|         default=os.environ["HOME"] + "/.patchodon.ini", | ||||
|         help=( | ||||
|             "specify a custom config INI file (it can specify a section" | ||||
|             " [patchodon] with keys instance_url and api_token), defaults to" | ||||
|             " `$HOME/.patchodon.ini'; specify /dev/null to avoid reading" | ||||
|             " configs" | ||||
|             "specify a custom config INI file that may specify a section" | ||||
|             " [patchodon] with keys instance_url and api_token; defaults to" | ||||
|             " `$HOME/.patchodon.ini', specify `/dev/null' to avoid config" | ||||
|             " loading" | ||||
|         ), | ||||
|     ) | ||||
|     args = ap.parse_args() | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue