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): | 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 |     pass | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @ -142,10 +147,8 @@ def main(): | ||||||
| 
 | 
 | ||||||
|     cmds = ap.add_subparsers(required=True, dest="command") |     cmds = ap.add_subparsers(required=True, dest="command") | ||||||
| 
 | 
 | ||||||
|     if "POST command": |  | ||||||
|         post = cmds.add_parser("post") |  | ||||||
|     if "API token sources": |     if "API token sources": | ||||||
|             group = post.add_mutually_exclusive_group() |         group = cmds.add_mutually_exclusive_group() | ||||||
|         group.add_argument( |         group.add_argument( | ||||||
|             "--debug-api-token", |             "--debug-api-token", | ||||||
|             help=( |             help=( | ||||||
|  | @ -160,21 +163,23 @@ def main(): | ||||||
|             help="get the API token from environment PATCHODON_API_TOKEN", |             help="get the API token from environment PATCHODON_API_TOKEN", | ||||||
|         ) |         ) | ||||||
| 
 | 
 | ||||||
|         post.add_argument( |     cmds.add_argument( | ||||||
|         "-i", |         "-i", | ||||||
|         "--instance-url", |         "--instance-url", | ||||||
|         help=( |         help=( | ||||||
|                 "mastodon instance URL to post to, such as" |             "mastodon instance URL to use, such as `https://mastodon.example/'" | ||||||
|                 " `https://mastodon.example/'" |  | ||||||
|         ), |         ), | ||||||
|     ) |     ) | ||||||
|  | 
 | ||||||
|  |     if "POST command": | ||||||
|  |         post = cmds.add_parser("post") | ||||||
|         post.add_argument( |         post.add_argument( | ||||||
|             "-r", |             "-r", | ||||||
|             "--recipient", |             "--recipient", | ||||||
|             default=None, |             default=None, | ||||||
|             help=( |             help=( | ||||||
|                 "user tag to prepend to all posted statuses (required esp. for" |                 "user tag to prepend to all posted statuses (required esp. for" | ||||||
|                 " direct sending of statuses))" |                 " direct sending of statuses)" | ||||||
|             ), |             ), | ||||||
|         ) |         ) | ||||||
|         post.add_argument( |         post.add_argument( | ||||||
|  | @ -182,8 +187,8 @@ def main(): | ||||||
|             "--subject", |             "--subject", | ||||||
|             default=None, |             default=None, | ||||||
|             help=( |             help=( | ||||||
|                 "start text of the initial post (e.g. to @tag someone and name" |                 "opening text of the initial post, ideally used to specify the" | ||||||
|                 " the project and topic)" |                 " target project and patch topic" | ||||||
|             ), |             ), | ||||||
|         ) |         ) | ||||||
|         post.add_argument( |         post.add_argument( | ||||||
|  | @ -209,7 +214,8 @@ def main(): | ||||||
|             group = get.add_mutually_exclusive_group() |             group = get.add_mutually_exclusive_group() | ||||||
|             group.add_argument( |             group.add_argument( | ||||||
|                 "-a", |                 "-a", | ||||||
|                 "--am", |                 "--run-git-am", | ||||||
|  |                 action="store_true", | ||||||
|                 help=( |                 help=( | ||||||
|                     "apply the patches immediately with git-am instead of" |                     "apply the patches immediately with git-am instead of" | ||||||
|                     " storing them in a directory" |                     " storing them in a directory" | ||||||
|  | @ -217,25 +223,29 @@ def main(): | ||||||
|             ) |             ) | ||||||
|             group.add_argument( |             group.add_argument( | ||||||
|                 "-C", |                 "-C", | ||||||
|                 "--out-dir", |                 "--out-prefix", | ||||||
|  |                 default="./patchodon-", | ||||||
|                 help=( |                 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( |             get.add_argument( | ||||||
|                 "--overwrite", |                 "--overwrite", | ||||||
|                 action="store_true", |                 action="store_true", | ||||||
|                 help="overwrite existing patch files instead of renaming", |                 help="overwrite existing patch files instead of failing", | ||||||
|             ) |             ) | ||||||
| 
 | 
 | ||||||
|     ap.add_argument( |     ap.add_argument( | ||||||
|         "-c", |         "-c", | ||||||
|         "--config", |         "--config", | ||||||
|  |         default=os.environ["HOME"] + "/.patchodon.ini", | ||||||
|         help=( |         help=( | ||||||
|             "specify a custom config INI file (it can specify a section" |             "specify a custom config INI file that may specify a section" | ||||||
|             " [patchodon] with keys instance_url and api_token), defaults to" |             " [patchodon] with keys instance_url and api_token; defaults to" | ||||||
|             " `$HOME/.patchodon.ini'; specify /dev/null to avoid reading" |             " `$HOME/.patchodon.ini', specify `/dev/null' to avoid config" | ||||||
|             " configs" |             " loading" | ||||||
|         ), |         ), | ||||||
|     ) |     ) | ||||||
|     args = ap.parse_args() |     args = ap.parse_args() | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue