fix: rework zipping of files, better build CI

Thanks to @npv12 for this PR!
This commit is contained in:
Pranav Santhosh
2022-12-11 10:39:45 +05:30
committed by GitHub
parent 35597b98d7
commit f523cb1881
6 changed files with 146 additions and 110 deletions

View File

@@ -7,64 +7,85 @@ Usage:
"""
import argparse
from scripts.ctp_colors import ctp_colors, get_all_accent
from scripts.create_theme import create_theme
from scripts.var import theme_name, tmp_dir
parser = argparse.ArgumentParser(description='Catppuccin theme')
parser.add_argument('type',
metavar='theme type',
parser = argparse.ArgumentParser(description="Catppuccin theme")
parser.add_argument("flavor",
metavar="theme flavor",
type=str,
choices=['mocha', 'frappe', 'macchiato', 'latte'],
help='Type of the theme to apply. Can be frappe, mocha, macchiato, latte')
nargs="+",
choices=["mocha", "frappe", "macchiato", "latte", "all"],
help="Flavor of the theme to apply. Can be frappe, mocha, macchiato, latte")
parser.add_argument('--name', '-n',
metavar='theme name',
parser.add_argument("--name", "-n",
metavar="theme name",
type=str,
default=theme_name,
dest="name",
help='Name of the theme to apply. Defaults to Catppuccin')
help="Name of the theme to apply. Defaults to Catppuccin")
parser.add_argument('--dest', '-d',
metavar='destination',
parser.add_argument("--dest", "-d",
metavar="destination",
type=str,
default=tmp_dir,
dest="dest",
help='Destination of the files. defaults to releases folder inside the root')
help="Destination of the files. defaults to releases folder inside the root")
parser.add_argument('--accent', '-a',
metavar='Accent of the theme',
parser.add_argument("--accent", "-a",
metavar="Accent of the theme",
type=str,
default="blue",
nargs="+",
default=["blue"],
dest="accent",
choices=['rosewater', 'flamingo', 'pink', 'mauve', 'red', 'maroon', 'peach',
'yellow', 'green', 'teal', 'sky', 'sapphire', 'blue', 'lavender'],
help="Accent of the theme. Can include 'rosewater', 'flamingo', 'pink', 'mauve', 'red', 'maroon', 'peach', 'yellow', 'green', 'teal', 'sky', 'sapphire', 'blue', 'lavender'")
choices=["rosewater", "flamingo", "pink", "mauve", "red", "maroon", "peach",
"yellow", "green", "teal", "sky", "sapphire", "blue", "lavender", "all"],
help="Accent of the theme. Can include 'rosewater', 'flamingo', 'pink', 'mauve', 'red', 'maroon', \
'peach', 'yellow', 'green', 'teal', 'sky', 'sapphire', 'blue', 'lavender'")
parser.add_argument("--size", "-s",
metavar='Size of the theme',
metavar="Size of the theme",
type=str,
default="standard",
dest="size",
choices=['standard', 'compact'],
help='Size variant of the theme. Can be standard or compact')
choices=["standard", "compact"],
help="Size variant of the theme. Can be standard or compact")
parser.add_argument('--tweaks',
metavar='Colloid specific tweaks',
parser.add_argument("--tweaks",
metavar="Colloid specific tweaks",
type=str,
default=[],
nargs='+',
nargs="+",
dest="tweaks",
choices=['black', 'rimless', 'normal'],
help='Some specifc tweaks. like black, rimless, normal buttons')
choices=["black", "rimless", "normal"],
help="Some specifc tweaks. like black, rimless, normal buttons")
parser.add_argument('--link',
help='Link advaita themes to our catppuccin theme',
parser.add_argument("-l", "--link",
help="Link advaita themes to our catppuccin theme",
type=bool,
default=True,
default=False,
action=argparse.BooleanOptionalAction,
dest="link",)
dest="link")
parser.add_argument("--zip",
help="Zip catppuccin theme",
type=bool,
default=False,
action=argparse.BooleanOptionalAction,
dest="zip")
args = parser.parse_args()
filename = create_theme(args.type, args.accent, args.dest,
args.link, args.name, args.size, args.tweaks)
if "all" in args.flavor:
flavors = ctp_colors.keys()
else:
flavors = args.flavor
if "all" in args.accent:
accents = get_all_accent().keys()
else:
accents = args.accent
filename = create_theme(flavors, accents, args.dest,
args.link, args.name, args.size, args.tweaks, args.zip)