def _process_arguments(args): #solo arguments #utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("obj_name", default="") parser.add_argument("-v", "--variation", action="store_true") parser.add_argument("-d", "--directory", action="store_true") parser.add_argument("-f", "--file", action="store_true") result = parser.parse_args(args) if result.variation: obj_type = InfoTypes.variation elif result.directory: obj_type = InfoTypes.directory elif result.file: obj_type = InfoTypes.file else: obj_type = InfoTypes.type_table log.debug( LogFmt(" |- parsed as (obj: '{0}', type: '{1}')", result.obj_name, obj_type)) return result.obj_name, obj_type
def _process_arguments(args): # solo arguments # utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("raw_path", nargs='?', default="") parser.add_argument("-x", "--dtree", action="store_true") parser.add_argument("-d", "--directories", action="store_true") parser.add_argument("-t", "--tables", action="store_true") parser.add_argument("-v", "--variations", action="store_true") parser.add_argument("-l", "--extended", action="store_true") result = parser.parse_args(args) if result.variations: task = ListTasks.variations elif result.directories: task = ListTasks.directories elif result.dtree: task = ListTasks.directory_tree elif result.tables: task = ListTasks.type_tables else: task = ListTasks.default log.debug(LogFmt(" |- parsed as (obj: '{0}', type: '{1}')", result.raw_path, task)) return result.raw_path, task, result.extended
def process(self, args): log.debug("User module gained control") log.debug("Arguments: \n " + " ".join(args)) if not len(args): # print current user print(self.context.provider.authentication.current_user_name) return #utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("--create", default="") parser.add_argument("--list", default="", action="store_true") result = parser.parse_args(args) if result.list: users = self.context.provider.get_users() for user in users: print(user.name) return if result.create: if not validate_name(result.create): raise ValueError( "Invalid user name. Only [a-z A-Z 0-9 _] symbols are allowed for user name" ) self.context.provider.create_user(result.create) print("{0} was created.".format(result.create)) return
def process(self, args): log.debug("MakeVariation module gained control") log.debug("Arguments: \n " + " ".join(args)) if not len(args): return # find #comment comment = "" for i in range(len(args)): arg = args[i] if arg.startswith("#"): comment = (" ".join(args[i:]))[1:] # [1:] to remove # args = args[:i] break # utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("name", default="") parser.add_argument("-p", "--parent", default="") result = parser.parse_args(args) parser.add_argument("--verbose", help="increase output verbosity", action="store_true") # in case there is a space between comments and name if not validate_name(result.name): raise ValueError("Invalid variation name. Only [a-z A-Z 0-9 _] symbols are allowed for variation name") # try to create directory log.debug(" creating variation. Name: {0}, comment: {1}".format(result.name, comment)) self.context.provider.create_variation(result.name, comment, result.parent) log.info("Variation " + result.name + self.theme.Success + " created" + self.theme.Reset)
def process_arguments(self, args): # solo arguments # utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("raw_path") parser.add_argument("-v", "--variation", default=self.context.current_variation) parser.add_argument("-r", "--run", default=self.context.current_run, type=int) return parser.parse_args(args)
def _process_arguments(args): parser = UtilityArgumentParser() parser.add_argument("raw_path", nargs='?', default="") parser.add_argument("-v", "--variation", default="") parser.add_argument("-r", "--run", type=int, default=-1) # parse result = parser.parse_args(args) return result.raw_path, result.variation, result.run
def process_arguments(self, args): #solo arguments #utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("raw_path") parser.add_argument("-v", "--variation", default=self.context.current_variation) parser.add_argument("-r", "--run", default=self.context.current_run, type=int) return parser.parse_args(args)
def process_arguments(self, args): # utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("obj_name", nargs="?", default="") parser.add_argument("-t", "--table", default="") parser.add_argument("-v", "--variation", default="") parser.add_argument("-u", "--user", default="") parser.add_argument("-d", "--date", default="") # TODO: Implement filter by date result = parser.parse_args(args) return result
def process(self, args): log.debug("MakeVariation module gained control") log.debug("Arguments: \n " + " ".join(args)) if not len(args): return #find #comment comment = "" for i in range(len(args)): arg = args[i] if arg.startswith("#"): comment = (" ".join(args[i:]))[1:] # [1:] to remove # args = args[:i] break #utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("name", default="") parser.add_argument("-p", "--parent", default="") result = parser.parse_args(args) parser.add_argument("--verbose", help="increase output verbosity", action="store_true") #in case there is a space between comments and name if not validate_name(result.name): raise ValueError( "Invalid variation name. Only [a-z A-Z 0-9 _] symbols are allowed for variation name" ) #try to create directory log.debug(" creating variation. Name: {0}, comment: {1}".format( result.name, comment)) self.context.provider.create_variation(result.name, comment, result.parent) log.info("Variation " + result.name + self.theme.Success + " created" + self.theme.Reset)
def _process_arguments(args): #solo arguments #utility argument parser is argparse which raises errors instead of exiting app parser = UtilityArgumentParser() parser.add_argument("obj_name", default="") parser.add_argument("-v", "--variation", action="store_true") parser.add_argument("-d", "--directory", action="store_true") parser.add_argument("-f", "--file", action="store_true") result = parser.parse_args(args) if result.variation: obj_type = InfoTypes.variation elif result.directory: obj_type = InfoTypes.directory elif result.file: obj_type = InfoTypes.file else: obj_type = InfoTypes.type_table log.debug(LogFmt(" |- parsed as (obj: '{0}', type: '{1}')", result.obj_name, obj_type)) return result.obj_name, obj_type