mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-06 07:19:29 -05:00
feat: impl scheme command (partial)
This commit is contained in:
@@ -61,7 +61,6 @@ def parse_args() -> (argparse.ArgumentParser, argparse.Namespace):
|
||||
# Create parser for scheme opts
|
||||
scheme_parser = command_parser.add_parser("scheme", help="manage the colour scheme")
|
||||
scheme_parser.set_defaults(cls=scheme.Command)
|
||||
scheme_parser.add_argument("-g", "--get", action="store_true", help="print the current scheme")
|
||||
scheme_parser.add_argument("-r", "--random", action="store_true", help="switch to a random scheme")
|
||||
scheme_parser.add_argument("-n", "--name", choices=get_scheme_names(), help="the name of the scheme to switch to")
|
||||
scheme_parser.add_argument("-f", "--flavour", help="the flavour to switch to")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
from argparse import Namespace
|
||||
|
||||
from caelestia.utils.scheme import get_scheme
|
||||
|
||||
|
||||
class Command:
|
||||
args: Namespace
|
||||
@@ -8,4 +10,16 @@ class Command:
|
||||
self.args = args
|
||||
|
||||
def run(self) -> None:
|
||||
pass
|
||||
scheme = get_scheme()
|
||||
|
||||
if self.args.random:
|
||||
scheme.set_random()
|
||||
elif self.args.name or self.args.flavour or self.args.mode:
|
||||
if self.args.name:
|
||||
scheme.name = self.args.name
|
||||
if self.args.flavour:
|
||||
scheme.flavour = self.args.flavour
|
||||
if self.args.mode:
|
||||
scheme.mode = self.args.mode
|
||||
else:
|
||||
print(scheme)
|
||||
|
||||
@@ -120,6 +120,9 @@ class Scheme:
|
||||
def _update_colours(self) -> None:
|
||||
self._colours = read_colours_from_file(self.get_colours_path())
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"Scheme(name={self.name}, flavour={self.flavour}, mode={self.mode}, variant={self.variant})"
|
||||
|
||||
|
||||
scheme_variants = [
|
||||
"tonalspot",
|
||||
|
||||
Reference in New Issue
Block a user