clan-flash: --keymap option also sets xserver keymap now. renamed 'clan flash apply' to clan 'flash write'
This commit is contained in:
@@ -182,9 +182,8 @@ For more detailed information, visit: {help_hyperlink("getting-started", "https:
|
||||
epilog=(
|
||||
f"""
|
||||
Examples:
|
||||
$ clan flash import installer
|
||||
$ clan flash apply installer --disk main /dev/sd<X> --ssh-pubkey ~/.ssh/id_rsa.pub
|
||||
Will create and flash a custom installer nixos image onto a drive
|
||||
$ clan flash write mymachine --disk main /dev/sd<X> --ssh-pubkey ~/.ssh/id_rsa.pub
|
||||
Will flash the machine 'mymachine' to the disk '/dev/sd<X>' with the ssh public key '~/.ssh/id_rsa.pub'.
|
||||
|
||||
For more detailed information, visit: {help_hyperlink("getting-started", "https://docs.clan.lol/getting-started/installer")}
|
||||
"""
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# !/usr/bin/env python3
|
||||
import argparse
|
||||
|
||||
from .flash_cmd import register_flash_apply_parser
|
||||
from .flash_cmd import register_flash_write_parser
|
||||
from .list import register_flash_list_parser
|
||||
|
||||
|
||||
@@ -14,11 +14,13 @@ def register_parser(parser: argparse.ArgumentParser) -> None:
|
||||
required=True,
|
||||
)
|
||||
|
||||
apply_parser = subparser.add_parser(
|
||||
"apply",
|
||||
help="Flash a machine",
|
||||
write_parser = subparser.add_parser(
|
||||
"write",
|
||||
help="Flash a machine to a disk",
|
||||
)
|
||||
register_flash_apply_parser(apply_parser)
|
||||
register_flash_write_parser(write_parser)
|
||||
|
||||
list_parser = subparser.add_parser("list", help="List options")
|
||||
list_parser = subparser.add_parser(
|
||||
"list", help="List possible keymaps or languages"
|
||||
)
|
||||
register_flash_list_parser(list_parser)
|
||||
|
||||
@@ -73,7 +73,7 @@ def flash_machine(
|
||||
if system_config.language not in list_possible_languages():
|
||||
msg = (
|
||||
f"Language '{system_config.language}' is not a valid language. "
|
||||
f"Run 'clan flash --list-languages' to see a list of possible languages."
|
||||
f"Run 'clan flash list languages' to see a list of possible languages."
|
||||
)
|
||||
raise ClanError(msg)
|
||||
system_config_nix["i18n"] = {"defaultLocale": system_config.language}
|
||||
@@ -82,10 +82,13 @@ def flash_machine(
|
||||
if system_config.keymap not in list_possible_keymaps():
|
||||
msg = (
|
||||
f"Keymap '{system_config.keymap}' is not a valid keymap. "
|
||||
f"Run 'clan flash --list-keymaps' to see a list of possible keymaps."
|
||||
f"Run 'clan flash list keymaps' to see a list of possible keymaps."
|
||||
)
|
||||
raise ClanError(msg)
|
||||
system_config_nix["console"] = {"keyMap": system_config.keymap}
|
||||
system_config_nix["services"] = {
|
||||
"xserver": {"xkb": {"layout": system_config.keymap}}
|
||||
}
|
||||
|
||||
if system_config.ssh_keys_path:
|
||||
root_keys = []
|
||||
|
||||
@@ -101,7 +101,7 @@ def flash_command(args: argparse.Namespace) -> None:
|
||||
)
|
||||
|
||||
|
||||
def register_flash_apply_parser(parser: argparse.ArgumentParser) -> None:
|
||||
def register_flash_write_parser(parser: argparse.ArgumentParser) -> None:
|
||||
machines_parser = parser.add_argument(
|
||||
"machine",
|
||||
type=str,
|
||||
|
||||
@@ -60,11 +60,11 @@ def list_possible_keymaps() -> list[str]:
|
||||
|
||||
|
||||
def list_command(args: argparse.Namespace) -> None:
|
||||
if args.options == "languages":
|
||||
if args.cmd == "languages":
|
||||
languages = list_possible_languages()
|
||||
for language in languages:
|
||||
print(language)
|
||||
elif args.options == "keymaps":
|
||||
elif args.cmd == "keymaps":
|
||||
keymaps = list_possible_keymaps()
|
||||
for keymap in keymaps:
|
||||
print(keymap)
|
||||
@@ -72,7 +72,7 @@ def list_command(args: argparse.Namespace) -> None:
|
||||
|
||||
def register_flash_list_parser(parser: argparse.ArgumentParser) -> None:
|
||||
parser.add_argument(
|
||||
"OPTION",
|
||||
"cmd",
|
||||
choices=["languages", "keymaps"],
|
||||
type=str,
|
||||
help="list possible languages or keymaps",
|
||||
|
||||
Reference in New Issue
Block a user