示例#1
0
 def _configure(self, parser):
     parser.add_argument("infile", nargs="*", type=FileType("r"),
                         default=[sys.stdin])
     parser.add_argument(
         "-k", "--keep-going", action="store_true", default=False,
         help="Continue processing after an error.")
     parser.set_defaults(func=self.__call__)
示例#2
0
    def _configure(self, parser):
        sub = parser.sub()

        script = sub.add_parser("script",
                                help="Generates a DB creation script")
        script.set_defaults(func=self.script)
        script.add_argument(
            "-f",
            "--file",
            type=FileType(mode="w"),
            help="Optional file to save to. Use '-' for stdout.")

        script.add_argument("posversion", nargs="?", help=SUPPRESS)
        script.add_argument("pospatch", nargs="?", help=SUPPRESS)
        script.add_argument("pospassword", nargs="?", help=SUPPRESS)

        script.add_argument("--version", help=SUPPRESS)
        script.add_argument("--patch", help=SUPPRESS)
        script.add_argument("--password", help="OMERO root password")

        pw = sub.add_parser(
            "password",
            help="Prints SQL command for updating your root password")
        pw.add_argument("password", nargs="?")
        pw.set_defaults(func=self.password)
        pw.add_argument("--user-id",
                        help="User ID to salt into the password. "
                        "Defaults to '0', i.e. 'root'",
                        default="0")

        for x in (pw, script):
            x.add_argument("--no-salt",
                           action="store_true",
                           help="Disable the salting of passwords")
示例#3
0
 def _configure(self, parser):
     parser.add_argument(
         "-l", "--list", action="store_true",
         help="List available commands")
     parser.add_argument(
         "file", nargs="*", type=FileType('r'), default=None,
         help="Read from files or standard in")
     parser.set_defaults(func=self.__call__)
     parser.add_login_arguments()
示例#4
0
    def _configure(self, parser):
        sub = parser.sub()

        script = sub.add_parser(
            "script", help="Generates a DB creation script")
        script.set_defaults(func=self.script)
        script.add_argument(
            "-f", "--file", type=FileType(mode="w"),
            help="Optional file to save to. Use '-' for stdout.")
        script.add_argument("dbversion", nargs="?")
        script.add_argument("dbpatch", nargs="?")
        script.add_argument("password", nargs="?")

        pw = sub.add_parser(
            "password",
            help="Prints SQL command for updating your root password")
        pw.add_argument("password", nargs="?")
        pw.set_defaults(func=self.password)
示例#5
0
 def __call__(self, string):
     if not os.path.exists(string):
         raise ValueError("File does not exist: %s" % string)
     return FileType.__call__(self, string)
示例#6
0
 def __call__(self, string):
     if string != "-" and os.path.exists(string):
         raise ValueError("File exists: %s" % string)
     return FileType.__call__(self, string)
示例#7
0
 def _configure(self, parser):
     parser.add_argument("infile",
                         nargs="*",
                         type=FileType("r"),
                         default=[sys.stdin])
     parser.set_defaults(func=self.__call__)