def __init__(self, version): self.parser = optparse.OptionParser( usage="%prog update old-host-url full-host-url] ", version="%prog " + version) self.parser.add_option('-c', '--config', default=site_cfg_path(), help="Path to config file: %default") self.parser.add_option('-f', '--force', action="store_true", default=False) self.parser.add_option('--dburl', default=None, help='Override dburl from site.cfg') options, args = self.parser.parse_args() if len(args) > 0: self.command = args.pop(0) else: self.parser.error("Need at least one command") self.args = args self.options = options if self.command not in ('update'): self.parser.error("illegal command")
def pylint(options): import pkgutil import ConfigParser from bq.util.paths import site_cfg_path import bq site_cfg = ConfigParser.ConfigParser() site_cfg.read(site_cfg_path()) share_path = site_cfg.get('app:main', 'bisque.paths.share') #args = 'bqcore/bq bqserver/bq bqengine/bq bqfeature/bq' opts = [] args = [] for arg in options.args: if arg.startswith('-'): opts.append(arg) else: args.append(arg) if args: args = " ".join(args) else: package = bq prefix = package.__name__ + "." args = [ modname for importer, modname, ispkg in pkgutil.iter_modules( package.__path__, prefix) ] args = " ".join(args) opts = " ".join(opts) sh('pylint --rcfile=%s --load-plugins=bq_pylint %s %s' % (os.path.join(share_path, '.pylintrc'), opts, args))
def __init__(self, version): parser = optparse.OptionParser(usage="%prog sql <sql>", version="%prog " + version) parser.add_option('-c', '--config', default=site_cfg_path(), help="Path to config file: %default") options, args = parser.parse_args() self.args = args self.options = options
def __init__(self, version): parser = optparse.OptionParser( usage="%prog stores [list|create [name]]|fill[name]|update[name]", version="%prog " + version) parser.add_option('-c', '--config', default=site_cfg_path(), help="Path to config file: %default") options, args = parser.parse_args() if len(args) < 1 or args[0] not in ('list', 'init', 'fill', 'update', 'move'): parser.error("No command given") self.command = args.pop(0) self.args = args self.options = options
def __init__(self, version): parser = optparse.OptionParser( usage="%prog preferences [init (db)|read (from db)|save (to db)]", version="%prog " + version) parser.add_option('-c', '--config', default=site_cfg_path(), help="Path to config file: %default") parser.add_option('-f', '--force', action="store_true", help="Force action if able") options, args = parser.parse_args() self.args = args self.options = options if len(args) == 0: parser.error('argument must be init, read, save')
def __init__(self, version): parser = optparse.OptionParser(usage="%prog database [admin]", version="%prog " + version) parser.add_option('-c', '--config', default=site_cfg_path(), help="Path to config file: %default") parser.add_option('-n', '--dryrun', action="store_true", default=False) options, args = parser.parse_args() self.args = args self.options = options if len(args) == 0: parser.error('argument must be clean') options, args = parser.parse_args() self.command = args[0] self.args = args[1:]
def __init__(self, version): parser = optparse.OptionParser( usage= "%prog password [convert: freetext to hashed][list: users and password][set: username password] ", version="%prog " + version) parser.add_option('-c', '--config', default=site_cfg_path(), help="Path to config file: %default") parser.add_option('-f', '--force', action="store_true", default=False) options, args = parser.parse_args() if len(args) > 0: self.command = args.pop(0) else: parser.error("Need at least one command") self.args = args self.options = options if self.command not in ('convert', 'set', 'list'): parser.error("illegal command")