def clone(arguments): theme = arguments['<theme>'] choices = util.get_theme_bundle() if theme not in choices: msg = 'Given theme %s does not exist. The choices are:' util.logger.error(msg, theme) list_themes(arguments) sys.exit(1) directory = arguments['<directory>'] if not directory: directory = theme theme_path = os.path.join(util.get_theme_bundle_path(), theme) theme_path = '%s/*' % theme_path if subprocess.call(['mkdir', '-p', directory]): msg = 'Could not create theme directory %s' util.logger.error(msg, directory) sys.exit(1) if subprocess.call(['cp', theme_path, directory]): msg = 'Could not copy theme content to directory %s' util.logger.error(msg, directory) sys.exit(1)
def list_themes(arguments): for theme in util.get_theme_bundle(): print theme