Some twiddeling around with argparse.
This commit is contained in:
		
							parent
							
								
									55d2175710
								
							
						
					
					
						commit
						9ff61743d2
					
				|  | @ -6,8 +6,16 @@ from argparse import ArgumentParser | ||||||
| 
 | 
 | ||||||
| # check for arguments and options | # check for arguments and options | ||||||
| parser = ArgumentParser(description="Manage your weblog via commandline. Creates a static html5 compliant website with your publications.") | parser = ArgumentParser(description="Manage your weblog via commandline. Creates a static html5 compliant website with your publications.") | ||||||
| parser.add_argument('--blog-dir', dest="blog_dir", default='~/public_html/blog', help='path to blog directory (default: %(default)s)') | parser.add_argument('-d','--blog-dir', dest="blog_dir", default='~/public_html/blog', help='path to blog directory (default: %(default)s)') | ||||||
| parser.add_argument('action', choices=['update'], help='updates blog to current state') | 
 | ||||||
|  | subparsers = parser.add_subparsers(help="subcommands") | ||||||
|  | parser_update = subparsers.add_parser('update', help='updates blog to current state') | ||||||
|  | parser_update.add_argument('subsection', choices=['all','articles','archive'], help='sections of blog you may want to update') | ||||||
|  | 
 | ||||||
|  | parser_draft = subparsers.add_parser('draft', help='create, list or edit drafts') | ||||||
|  | 
 | ||||||
|  | parser_article = subparsers.add_parser('article', help='import, list, edit or delete [article]') | ||||||
|  | 
 | ||||||
| args = parser.parse_args() | args = parser.parse_args() | ||||||
| print(vars(args)) | print(vars(args)) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue