Пример #1
0
    def prepare_parser(self):
        parser = CustomArgumentParser(
            prog=self.name,
            usage=self.usage,
            add_help=False,
            description=self.__doc__,
        )
        subparsers = parser.add_subparsers(dest='cmd', required=True)
        parser.add_argument('-h',
                            '--help',
                            action='help',
                            default=ARG_SUPPRESS,
                            help='Show this help message and exit.')

        parser_list = subparsers.add_parser(
            'list',
            prog='list',
            aliases=['ls'],
            add_help=False,
            description='List all tags with counts.')
        parser_list.add_argument('-h',
                                 '--help',
                                 action='help',
                                 default=ARG_SUPPRESS,
                                 help='Show this help message and exit.')

        parser_clear_empty = subparsers.add_parser(
            'clear_empty',
            prog='clear_empty',
            aliases=['cle'],
            add_help=False,
            description='Clear those tags which no notes are tagged by.')
        parser_clear_empty.add_argument(
            '-h',
            '--help',
            action='help',
            default=ARG_SUPPRESS,
            help='Show this help message and exit.')

        parser_rename = subparsers.add_parser(
            'rename',
            prog='rename',
            add_help=False,
            description=(
                'Rename tag. Note that tag name should be escaped by slash '
                'because the hash mark "#" indicating a comment in bash shell.'
            ))
        parser_rename.add_argument('old_name',
                                   metavar='<old_name>',
                                   help='Old name of target tag to rename.')
        parser_rename.add_argument('new_name',
                                   metavar='<new_name>',
                                   help='New name of target tag to rename.')
        parser_rename.add_argument('-h',
                                   '--help',
                                   action='help',
                                   default=ARG_SUPPRESS,
                                   help='Show this help message and exit.')
        return parser
Пример #2
0
    def prepare_parser(self):
        parser = CustomArgumentParser(
            prog=self.name, usage=self.usage, add_help=False,
            description=self.__doc__,
        )
        parser.add_argument(
            '--multiple', action='store_true',
            help=(
                'If this flag is set, user can select multiple notebooks in '
                'the interactive mode.'
            )
        )
        parser.add_argument(
            '--date', action='store_true',
            help='Show create_time and update_time of notes.'
        )
        parser.add_argument(
            '--uuid', action='store_true',
            help='Show uuid of notes.'
        )
        parser.add_argument(
            '-h', '--help', action='help',
            default=ARG_SUPPRESS,
            help='Show this help message and exit.'
        )

        subparsers = parser.add_subparsers(dest='cmd')
        parser_clear = subparsers.add_parser(
            'clear', prog='clear', add_help=False,
            description='Clear selected notes from cache.'
        )
        parser_clear.add_argument(
            '-h', '--help', action='help',
            default=ARG_SUPPRESS,
            help='Show this help message and exit.'
        )

        parser_list = subparsers.add_parser(
            'list', prog='list', aliases=['ls'], add_help=False,
            description='List all selected notes in cache.'
        )
        parser_list.add_argument(
            '--date', action='store_true',
            help='Show create_time and update_time of notes.'
        )
        parser_list.add_argument(
            '--uuid', action='store_true',
            help='Show uuid of notes.'
        )
        parser_list.add_argument(
            '-h', '--help', action='help',
            default=ARG_SUPPRESS,
            help='Show this help message and exit.'
        )
        return parser
Пример #3
0
    def prepare_parser(self):
        parser = CustomArgumentParser(
            prog=self.name,
            usage=self.usage,
            add_help=False,
            description=self.__doc__,
        )
        subparsers = parser.add_subparsers(dest='cmd')

        parser.add_argument(
            '--uuid',
            dest='uuid',
            metavar='<note_uuid>',
            default=None,
            help=(
                'UUID of the note to open. If this argument is not given, '
                'interactive mode will start and user can select a note from '
                'notebook.'))
        parser.add_argument('--editor_name',
                            dest='editor_name',
                            metavar='<editor_name>',
                            help='Open and edit a note with specified editor.')
        parser.add_argument('-h',
                            '--help',
                            action='help',
                            default=ARG_SUPPRESS,
                            help='Show this help message and exit.')

        parser_selected = subparsers.add_parser(
            'selected',
            prog='selected',
            aliases=['sel'],
            add_help=False,
            description=
            'Open note from selected list (gerenated by `qnote select`).')
        parser_selected.add_argument(
            '--editor_name',
            dest='editor_name',
            metavar='<editor_name>',
            help='Open and edit a note with specified editor.')
        parser_selected.add_argument('-h',
                                     '--help',
                                     action='help',
                                     default=ARG_SUPPRESS,
                                     help='Show this help message and exit.')

        return parser