mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
Add help strings to all click CMDs
This commit is contained in:
parent
feadf6f1e8
commit
3ed8d379dd
10 changed files with 31 additions and 4 deletions
2
boot.py
2
boot.py
|
@ -18,7 +18,7 @@ TYPES = [LK2ND, JUMPDRIVE, ABOOT]
|
|||
@click.command(name='boot')
|
||||
@click.argument('type', required=False, default=ABOOT, type=click.Choice(TYPES))
|
||||
def cmd_boot(type):
|
||||
f"""Flash one of {', '.join(TYPES)}"""
|
||||
"""Boot JumpDrive or the Kupfer aboot image. Erases Android DTBO in the process."""
|
||||
enforce_wrap()
|
||||
device, flavour = get_device_and_flavour()
|
||||
# TODO: parse arch and sector size
|
||||
|
|
1
cache.py
1
cache.py
|
@ -10,6 +10,7 @@ PATHS = ['chroots', 'pacman', 'jumpdrive', 'packages', 'images']
|
|||
|
||||
@click.group(name='cache')
|
||||
def cmd_cache():
|
||||
"""Clean caches and chroots"""
|
||||
pass
|
||||
|
||||
|
||||
|
|
|
@ -550,6 +550,7 @@ class Chroot:
|
|||
@click.argument('type', required=False, default='build')
|
||||
@click.argument('arch', required=False, default=None)
|
||||
def cmd_chroot(type: str = 'build', arch: str = None, enable_crossdirect=True):
|
||||
"""Open a shell in a chroot"""
|
||||
chroot_path = ''
|
||||
if type not in ['base', 'build', 'rootfs']:
|
||||
raise Exception('Unknown chroot type: ' + type)
|
||||
|
|
|
@ -447,6 +447,7 @@ config_option = click.option(
|
|||
|
||||
@click.group(name='config')
|
||||
def cmd_config():
|
||||
"""Manage the configuration and -profiles"""
|
||||
pass
|
||||
|
||||
|
||||
|
|
1
flash.py
1
flash.py
|
@ -20,6 +20,7 @@ ROOTFS = FLASH_PARTS['ROOTFS']
|
|||
@click.argument('what', type=click.Choice(list(FLASH_PARTS.values())))
|
||||
@click.argument('location', required=False, type=click.Choice(LOCATIONS))
|
||||
def cmd_flash(what, location):
|
||||
"""Flash a partition onto a device"""
|
||||
enforce_wrap()
|
||||
device, flavour = get_device_and_flavour()
|
||||
device_image_name = get_image_name(device, flavour)
|
||||
|
|
|
@ -7,6 +7,7 @@ from wrapper import check_programs_wrap
|
|||
|
||||
@click.command(name='forwarding')
|
||||
def cmd_forwarding():
|
||||
"""Enable network forwarding for a usb-attached device"""
|
||||
check_programs_wrap(['syctl', 'iptables'])
|
||||
|
||||
result = subprocess.run([
|
||||
|
|
3
image.py
3
image.py
|
@ -333,6 +333,7 @@ def install_rootfs(rootfs_device: str, bootfs_device: str, device, flavour, arch
|
|||
|
||||
@click.group(name='image')
|
||||
def cmd_image():
|
||||
"""Build and manage device images"""
|
||||
pass
|
||||
|
||||
|
||||
|
@ -342,6 +343,7 @@ def cmd_image():
|
|||
@click.option('--block-target', default=None, help='Override the block device file to target')
|
||||
@click.option('--skip-part-images', default=False, help='Skip creating image files for the partitions and directly work on the target block device.')
|
||||
def cmd_build(profile_name: str = None, build_pkgs: bool = True, block_target: str = None, skip_part_images: bool = False):
|
||||
"""Build a device image"""
|
||||
enforce_wrap()
|
||||
profile = config.get_profile(profile_name)
|
||||
device, flavour = get_device_and_flavour(profile_name)
|
||||
|
@ -415,6 +417,7 @@ def cmd_build(profile_name: str = None, build_pkgs: bool = True, block_target: s
|
|||
@cmd_image.command(name='inspect')
|
||||
@click.option('--shell', '-s', is_flag=True)
|
||||
def cmd_inspect(shell: bool = False):
|
||||
"""Open a shell in a device image"""
|
||||
enforce_wrap()
|
||||
device, flavour = get_device_and_flavour()
|
||||
# TODO: get arch from profile
|
||||
|
|
23
packages.py
23
packages.py
|
@ -627,21 +627,30 @@ def build_enable_qemu_binfmt(arch: Arch, repo: dict[str, Package] = None):
|
|||
|
||||
@click.group(name='packages')
|
||||
def cmd_packages():
|
||||
"""Build and manage packages and PKGBUILDs"""
|
||||
pass
|
||||
|
||||
|
||||
@cmd_packages.command(name='update')
|
||||
@click.option('--non-interactive', is_flag=True)
|
||||
def cmd_update(non_interactive: bool = False):
|
||||
"""Update PKGBUILDs git repo"""
|
||||
enforce_wrap()
|
||||
init_pkgbuilds(interactive=not non_interactive)
|
||||
|
||||
|
||||
@cmd_packages.command(name='build')
|
||||
@click.option('--force', is_flag=True, default=False)
|
||||
@click.option('--arch', default=None)
|
||||
@click.option('--force', is_flag=True, default=False, help='Rebuild even if package is already built')
|
||||
@click.option('--arch', default=None, help="The CPU architecture to build for")
|
||||
@click.argument('paths', nargs=-1)
|
||||
def cmd_build(paths: list[str], force=False, arch=None):
|
||||
"""
|
||||
Build packages by paths.
|
||||
|
||||
The paths are specified relative to the PKGBUILDs dir, eg. "cross/crossdirect".
|
||||
|
||||
Multiple paths may be specified as separate arguments.
|
||||
"""
|
||||
build(paths, force, arch)
|
||||
|
||||
|
||||
|
@ -673,6 +682,7 @@ def build(paths: list[str], force: bool, arch: Arch):
|
|||
@cmd_packages.command(name='sideload')
|
||||
@click.argument('paths', nargs=-1)
|
||||
def cmd_sideload(paths: list[str]):
|
||||
"""Build packages, copy to the device via SSH and install them"""
|
||||
files = build(paths, True, None)
|
||||
scp_put_files(files, '/tmp')
|
||||
run_ssh_command([
|
||||
|
@ -687,8 +697,14 @@ def cmd_sideload(paths: list[str]):
|
|||
|
||||
|
||||
@cmd_packages.command(name='clean')
|
||||
def cmd_clean():
|
||||
@click.option('--force', is_flag=True, default=False, help="Don't prompt for confirmation")
|
||||
def cmd_clean(force: bool = False):
|
||||
"""Remove files and directories not tracked in PKGBUILDs.git"""
|
||||
enforce_wrap()
|
||||
|
||||
warning = "Really reset PKGBUILDs to git state completely?\nThis will erase any untracked changes to your PKGBUILDs directory."
|
||||
if not (force or click.confirm(warning)):
|
||||
return
|
||||
result = git(
|
||||
[
|
||||
'clean',
|
||||
|
@ -704,6 +720,7 @@ def cmd_clean():
|
|||
@cmd_packages.command(name='check')
|
||||
@click.argument('paths', nargs=-1)
|
||||
def cmd_check(paths):
|
||||
"""Check that specified PKGBUILDs are formatted correctly"""
|
||||
enforce_wrap()
|
||||
paths = list(paths)
|
||||
packages = filter_packages_by_paths(discover_packages(), paths, allow_empty_results=False)
|
||||
|
|
1
ssh.py
1
ssh.py
|
@ -10,6 +10,7 @@ from wrapper import enforce_wrap
|
|||
|
||||
@click.command(name='ssh')
|
||||
def cmd_ssh():
|
||||
"""Establish SSH connection over USB to device"""
|
||||
enforce_wrap()
|
||||
run_ssh_command()
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ from wrapper import check_programs_wrap
|
|||
|
||||
@click.command(name='telnet')
|
||||
def cmd_telnet(hostname: str = '172.16.42.1'):
|
||||
"""Establish Telnet connection to device (e.g in debug-initramfs)"""
|
||||
check_programs_wrap('telnet')
|
||||
subprocess.run([
|
||||
'telnet',
|
||||
|
|
Loading…
Add table
Reference in a new issue