예제 #1
0
 def testQuote(self):
     parser = YokadiOptionParser()
     parser.add_argument("cmd", nargs='*')
     src = "There's a quote here"
     args = parser.parse_args(src)
     # Recreate the line
     line = " ".join(args.cmd)
     self.assertEqual(line, src)
예제 #2
0
 def testDash(self):
     parser = YokadiOptionParser()
     parser.add_argument("cmd", nargs="*")
     srcs = ["foo-bar", "foo - bar"]
     for src in srcs:
         args = parser.parse_args(src)
         # Recreate the line
         line = " ".join(args.cmd)
         self.assertEqual(line, src)
예제 #3
0
 def testDash(self):
     parser = YokadiOptionParser()
     parser.add_argument("cmd", nargs="*")
     srcs = ["foo-bar", "foo - bar"]
     for src in srcs:
         args = parser.parse_args(src)
         # Recreate the line
         line = " ".join(args.cmd)
         self.assertEqual(line, src)
예제 #4
0
 def parser_p_merge(self):
     parser = YokadiOptionParser()
     parser.usage = "p_remove <source_project> <destination_project>"
     parser.description = "Merge <source_project> into <destination_project>."
     parser.add_argument("source_project")
     parser.add_argument("destination_project")
     parser.add_argument("-f",
                         dest="force",
                         default=False,
                         action="store_true",
                         help="Skip confirmation prompt")
     return parser
예제 #5
0
 def parser_p_merge(self):
     parser = YokadiOptionParser()
     parser.usage = "p_remove <source_project> <destination_project>"
     parser.description = "Merge <source_project> into <destination_project>."
     parser.add_argument("source_project")
     parser.add_argument("destination_project")
     parser.add_argument("-f", dest="force", default=False, action="store_true",
                         help="Skip confirmation prompt")
     return parser
예제 #6
0
파일: taskcmd.py 프로젝트: fabaff/yokadi
 def _parser_t_add(self, cmd):
     """Code shared by t_add, bug_add and n_add parsers."""
     parser = YokadiOptionParser()
     parser.usage = "%s [options] <projectName> [@<keyword1>] [@<keyword2>] <title>" % cmd
     parser.description = "Add new %s. Will prompt to create keywords if they do not exist." % cmd
     parser.add_argument("-c", dest="crypt", default=False, action="store_true",
                       help="Encrypt title")
     parser.add_argument("-d", "--describe", dest="describe", default=False, action="store_true",
                       help="Directly open editor to describe task")
     parser.add_argument('cmd', nargs='*')
     return parser
예제 #7
0
 def parser_p_remove(self):
     parser = YokadiOptionParser()
     parser.usage = "p_remove [options] <project_name>"
     parser.description = "Remove a project and all its associated tasks."
     parser.add_argument("-f", dest="force", default=False, action="store_true",
                       help="Skip confirmation prompt")
     parser.add_argument("project")
     return parser
예제 #8
0
파일: taskcmd.py 프로젝트: fabaff/yokadi
 def parser_t_show(self):
     parser = YokadiOptionParser()
     parser.usage = "t_show [options] <id>"
     parser.description = "Display details of a task."
     choices = ["all", "summary", "description"]
     parser.add_argument("--output", dest="output",
                       choices=choices,
                       default="all",
                       help="<output> can be one of %s. If not set, it defaults to all." % ", ".join(choices),
                       metavar="<output>")
     parser.add_argument("--decrypt", dest="decrypt", default=False, action="store_true",
                       help="Decrypt task title and description")
     parser.add_argument("id")
     return parser
예제 #9
0
파일: projectcmd.py 프로젝트: fabaff/yokadi
 def parser_p_remove(self):
     parser = YokadiOptionParser()
     parser.usage = "p_remove [options] <project_name>"
     parser.description = "Remove a project and all its associated tasks."
     parser.add_argument("-f", dest="force", default=False, action="store_true", help="Skip confirmation prompt")
     parser.add_argument("project")
     return parser
예제 #10
0
 def parser_c_get(self):
     parser = YokadiOptionParser(prog="c_get")
     parser.description = "Display the value of a configuration key. If no key is given, all keys are shown."
     parser.add_argument("-s", dest="system", default=False, action="store_true",
                         help="Display value of system keys instead of user ones")
     parser.add_argument("key", nargs='?')
     return parser
예제 #11
0
파일: taskcmd.py 프로젝트: bport/yokadi
 def _parser_t_add(self, cmd):
     """Code shared by t_add, bug_add and n_add parsers."""
     parser = YokadiOptionParser()
     parser.usage = "%s [options] <projectName> [@<keyword1>] [@<keyword2>] <title>" % cmd
     parser.description = "Add new %s. Will prompt to create keywords if they do not exist." % cmd
     parser.add_argument("-c",
                         dest="crypt",
                         default=False,
                         action="store_true",
                         help="Encrypt title")
     parser.add_argument("-d",
                         "--describe",
                         dest="describe",
                         default=False,
                         action="store_true",
                         help="Directly open editor to describe task")
     parser.add_argument('cmd', nargs='*')
     return parser
예제 #12
0
파일: taskcmd.py 프로젝트: bport/yokadi
 def parser_t_remove(self):
     parser = YokadiOptionParser()
     parser.usage = "t_remove [options] <id>"
     parser.description = "Delete a task."
     parser.add_argument("-f",
                         dest="force",
                         default=False,
                         action="store_true",
                         help="Skip confirmation prompt")
     parser.add_argument("id")
     return parser
예제 #13
0
파일: taskcmd.py 프로젝트: fabaff/yokadi
 def parser_t_remove(self):
     parser = YokadiOptionParser()
     parser.usage = "t_remove [options] <id>"
     parser.description = "Delete a task."
     parser.add_argument("-f", dest="force", default=False, action="store_true",
                       help="Skip confirmation prompt")
     parser.add_argument("id")
     return parser
예제 #14
0
파일: taskcmd.py 프로젝트: bport/yokadi
 def parser_t_show(self):
     parser = YokadiOptionParser()
     parser.usage = "t_show [options] <id>"
     parser.description = "Display details of a task."
     choices = ["all", "summary", "description"]
     parser.add_argument(
         "--output",
         dest="output",
         choices=choices,
         default="all",
         help="<output> can be one of %s. If not set, it defaults to all." %
         ", ".join(choices),
         metavar="<output>")
     parser.add_argument("--decrypt",
                         dest="decrypt",
                         default=False,
                         action="store_true",
                         help="Decrypt task title and description")
     parser.add_argument("id")
     return parser
예제 #15
0
파일: taskcmd.py 프로젝트: fabaff/yokadi
 def parser_t_purge(self):
     parser = YokadiOptionParser()
     parser.usage = "t_purge [options]"
     parser.description = "Remove old done tasks from all projects."
     parser.add_argument("-f", "--force", dest="force", default=False, action="store_true",
                       help="Skip confirmation prompt")
     delay = int(db.getConfigKey("PURGE_DELAY", environ=False))
     parser.add_argument("-d", "--delay", dest="delay", default=delay,
                       type=int, help="Delay (in days) after which done tasks are destroyed. Default is %d." % delay)
     return parser
예제 #16
0
파일: confcmd.py 프로젝트: hswick/yokadi
 def parser_c_get(self):
     parser = YokadiOptionParser(prog="c_get")
     parser.description = "Display the value of a configuration key. If no key is given, all keys are shown."
     parser.add_argument("-s", dest="system", default=False, action="store_true",
                       help="Display value of system keys instead of user ones")
     parser.add_argument("key", nargs='?')
     return parser
예제 #17
0
파일: taskcmd.py 프로젝트: agateau/yokadi
    def parser_n_list(self):
        parser = YokadiOptionParser()
        parser.usage = "n_list [options] <project_or_keyword_filter>"
        parser.description = "List notes filtered by project and/or keywords. " \
            "'%' can be used as a wildcard in the project name: " \
            "to list projects starting with 'foo', use 'foo%'. " \
            "Keyword filtering is achieved with '@'. Ex.: " \
            "n_list @home, n_list @_bug=2394"

        parser.add_argument("-s", "--search", dest="search",
                            action="append",
                            help="only list notes whose title or description match <value>."
                                 " You can repeat this option to search on multiple words.",
                            metavar="<value>")

        parser.add_argument("-k", "--keyword", dest="keyword",
                            help="Group tasks by given keyword instead of project. The '%%' wildcard can be used.",
                            metavar="<keyword>")
        parser.add_argument("filter", nargs="*", metavar="<project_or_keyword_filter>")

        return parser
예제 #18
0
파일: taskcmd.py 프로젝트: bport/yokadi
 def parser_t_purge(self):
     parser = YokadiOptionParser()
     parser.usage = "t_purge [options]"
     parser.description = "Remove old done tasks from all projects."
     parser.add_argument("-f",
                         "--force",
                         dest="force",
                         default=False,
                         action="store_true",
                         help="Skip confirmation prompt")
     delay = int(Config.byName("PURGE_DELAY").value)
     parser.add_argument(
         "-d",
         "--delay",
         dest="delay",
         default=delay,
         type=int,
         help=
         "Delay (in days) after which done tasks are destroyed. Default is %d."
         % delay)
     return parser
예제 #19
0
파일: taskcmd.py 프로젝트: fabaff/yokadi
    def parser_t_list(self):
        parser = YokadiOptionParser()
        parser.usage = "t_list [options] <project_or_keyword_filter>"
        parser.description = "List tasks filtered by project and/or keywords. " \
                             "'%' can be used as a wildcard in the project name: " \
                             "to list projects starting with 'foo', use 'foo%'. " \
                             "Keyword filtering is achieved with '@'. Ex.: " \
                             "t_list @home, t_list @_bug=2394"

        parser.add_argument("-a", "--all", dest="status",
                          action="store_const", const="all",
                          help="all tasks (done and to be done)")

        parser.add_argument("--started", dest="status",
                          action="store_const", const="started",
                          help="only started tasks")

        rangeList = ["today", "thisweek", "thismonth", "all"]
        parser.add_argument("-d", "--done", dest="done",
                          help="only done tasks. <range> must be either one of %s or a date using the same format as t_due" % ", ".join(rangeList),
                          metavar="<range>")

        parser.add_argument("-u", "--urgency", dest="urgency",
                          type=int,
                          help="tasks with urgency greater or equal than <urgency>",
                          metavar="<urgency>")

        parser.add_argument("-t", "--top-due", dest="topDue",
                          default=False, action="store_true",
                          help="top 5 urgent tasks of each project based on due date")

        parser.add_argument("--overdue", dest="due",
                          action="append_const", const="now",
                          help="all overdue tasks")

        parser.add_argument("--due", dest="due",
                          action="append",
                          help="""only list tasks due before/after <limit>. <limit> is a
                          date optionaly prefixed with a comparison operator.
                          Valid operators are: <, <=, >=, and >.
                          Example of valid limits:

                          - tomorrow: due date <= tomorrow, 23:59:59
                          - today: due date <= today, 23:59:59
                          - >today: due date > today: 23:59:59
                          """,
                          metavar="<limit>")

        parser.add_argument("-k", "--keyword", dest="keyword",
                          help="Group tasks by given keyword instead of project. The %% wildcard can be used.",
                          metavar="<keyword>")

        parser.add_argument("-s", "--search", dest="search",
                          action="append",
                          help="only list tasks whose title or description match <value>. You can repeat this option to search on multiple words.",
                          metavar="<value>")

        formatList = ["auto"] + list(gRendererClassDict.keys())
        parser.add_argument("-f", "--format", dest="format",
                          default="auto", choices=formatList,
                          help="how should the task list be formated. <format> can be %s" % ", ".join(formatList),
                          metavar="<format>")
        parser.add_argument("-o", "--output", dest="output",
                          help="Output task list to <file>",
                          metavar="<file>")
        parser.add_argument("--decrypt", dest="decrypt", default=False, action="store_true",
                          help="Decrypt task title and description")

        parser.add_argument("filter", nargs="*", metavar="<project_or_keyword_filter>")

        return parser
예제 #20
0
파일: taskcmd.py 프로젝트: bport/yokadi
    def parser_n_list(self):
        parser = YokadiOptionParser()
        parser.usage = "n_list [options] <project_or_keyword_filter>"
        parser.description = "List notes filtered by project and/or keywords. " \
                                 "'%' can be used as a wildcard in the project name: " \
                                 "to list projects starting with 'foo', use 'foo%'. " \
                                 "Keyword filtering is achieved with '@'. Ex.: " \
                                 "n_list @home, n_list @_bug=2394"

        parser.add_argument(
            "-s",
            "--search",
            dest="search",
            action="append",
            help=
            "only list notes whose title or description match <value>. You can repeat this option to search on multiple words.",
            metavar="<value>")

        parser.add_argument(
            "-k",
            "--keyword",
            dest="keyword",
            help=
            "Group tasks by given keyword instead of project. The % wildcard can be used.",
            metavar="<keyword>")
        parser.add_argument("--decrypt",
                            dest="decrypt",
                            default=False,
                            action="store_true",
                            help="Decrypt note title and description")
        parser.add_argument("filter",
                            nargs="*",
                            metavar="<project_or_keyword_filter>")

        return parser
예제 #21
0
파일: taskcmd.py 프로젝트: bport/yokadi
    def parser_t_list(self):
        parser = YokadiOptionParser()
        parser.usage = "t_list [options] <project_or_keyword_filter>"
        parser.description = "List tasks filtered by project and/or keywords. " \
                             "'%' can be used as a wildcard in the project name: " \
                             "to list projects starting with 'foo', use 'foo%'. " \
                             "Keyword filtering is achieved with '@'. Ex.: " \
                             "t_list @home, t_list @_bug=2394"

        parser.add_argument("-a",
                            "--all",
                            dest="status",
                            action="store_const",
                            const="all",
                            help="all tasks (done and to be done)")

        parser.add_argument("--started",
                            dest="status",
                            action="store_const",
                            const="started",
                            help="only started tasks")

        rangeList = ["today", "thisweek", "thismonth", "all"]
        parser.add_argument(
            "-d",
            "--done",
            dest="done",
            help=
            "only done tasks. <range> must be either one of %s or a date using the same format as t_due"
            % ", ".join(rangeList),
            metavar="<range>")

        parser.add_argument(
            "-u",
            "--urgency",
            dest="urgency",
            type=int,
            help="tasks with urgency greater or equal than <urgency>",
            metavar="<urgency>")

        parser.add_argument(
            "-t",
            "--top-due",
            dest="topDue",
            default=False,
            action="store_true",
            help="top 5 urgent tasks of each project based on due date")

        parser.add_argument("--overdue",
                            dest="due",
                            action="append_const",
                            const="now",
                            help="all overdue tasks")

        parser.add_argument(
            "--due",
            dest="due",
            action="append",
            help="""only list tasks due before/after <limit>. <limit> is a
                          date optionaly prefixed with a comparison operator.
                          Valid operators are: <, <=, >=, and >.
                          Example of valid limits:

                          - tomorrow: due date <= tomorrow, 23:59:59
                          - today: due date <= today, 23:59:59
                          - >today: due date > today: 23:59:59
                          """,
            metavar="<limit>")

        parser.add_argument(
            "-k",
            "--keyword",
            dest="keyword",
            help=
            "Group tasks by given keyword instead of project. The %% wildcard can be used.",
            metavar="<keyword>")

        parser.add_argument(
            "-s",
            "--search",
            dest="search",
            action="append",
            help=
            "only list tasks whose title or description match <value>. You can repeat this option to search on multiple words.",
            metavar="<value>")

        formatList = ["auto"] + gRendererClassDict.keys()
        parser.add_argument(
            "-f",
            "--format",
            dest="format",
            default="auto",
            choices=formatList,
            help="how should the task list be formated. <format> can be %s" %
            ", ".join(formatList),
            metavar="<format>")
        parser.add_argument("-o",
                            "--output",
                            dest="output",
                            help="Output task list to <file>",
                            metavar="<file>")
        parser.add_argument("--decrypt",
                            dest="decrypt",
                            default=False,
                            action="store_true",
                            help="Decrypt task title and description")

        parser.add_argument("filter",
                            nargs="*",
                            metavar="<project_or_keyword_filter>")

        return parser
예제 #22
0
    def testUknownOption(self):
        def parseUnknownOption():
            parser.parse_args("blabla -b")

        parser = YokadiOptionParser()
        self.assertRaises(YokadiException, parseUnknownOption)