Last active
August 29, 2015 14:03
-
-
Save grplyler/b6ae93b91e84953f259e to your computer and use it in GitHub Desktop.
Display --export options
This file contains 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 characters
def parse_args(args=None): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('-v', '--version', dest='version', action="store_true", help="prints version information and exits") | |
parser.add_argument('-ls', dest='ls', action="store_true", help="displays accessible journals") | |
composing = parser.add_argument_group('Composing', 'To write an entry simply write it on the command line, e.g. "jrnl yesterday at 1pm: Went to the gym."') | |
composing.add_argument('text', metavar='', nargs="*") | |
reading = parser.add_argument_group('Reading', 'Specifying either of these parameters will display posts of your journal') | |
reading.add_argument('-from', dest='start_date', metavar="DATE", help='View entries after this date') | |
reading.add_argument('-until', '-to', dest='end_date', metavar="DATE", help='View entries before this date') | |
reading.add_argument('-and', dest='strict', action="store_true", help='Filter by tags using AND (default: OR)') | |
reading.add_argument('-starred', dest='starred', action="store_true", help='Show only starred entries') | |
reading.add_argument('-n', dest='limit', default=None, metavar="N", help="Shows the last n entries matching the filter. '-n 3' and '-3' have the same effect.", nargs="?", type=int) | |
exporting = parser.add_argument_group('Export / Import', 'Options for transmogrifying your journal') | |
exporting.add_argument('--short', dest='short', action="store_true", help='Show only titles or line containing the search tags') | |
exporting.add_argument('--tags', dest='tags', action="store_true", help='Returns a list of all tags and number of occurences') | |
### Added choices to --export ### | |
exporting.add_argument('--export', metavar='TYPE', dest='export', choices=['text','json','markdown'], | |
help='Export your journal. Options: json, text, markdown', default=False, const=None) | |
exporting.add_argument('-o', metavar='OUTPUT', dest='output', help='The output of the file can be provided when using with --export', default=False, const=None) | |
exporting.add_argument('--encrypt', metavar='FILENAME', dest='encrypt', help='Encrypts your existing journal with a new password', nargs='?', default=False, const=None) | |
exporting.add_argument('--decrypt', metavar='FILENAME', dest='decrypt', help='Decrypts your journal and stores it in plain text', nargs='?', default=False, const=None) | |
exporting.add_argument('--edit', dest='edit', help='Opens your editor to edit the selected entries.', action="store_true") | |
return parser.parse_args(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment