diff --git a/boot.py b/boot.py index 1ff8218..c55ee59 100644 --- a/boot.py +++ b/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 diff --git a/cache.py b/cache.py index 26cb568..14500b0 100644 --- a/cache.py +++ b/cache.py @@ -10,6 +10,7 @@ PATHS = ['chroots', 'pacman', 'jumpdrive', 'packages', 'images'] @click.group(name='cache') def cmd_cache(): + """Clean caches and chroots""" pass diff --git a/chroot.py b/chroot.py index 9404d7f..fe07713 100644 --- a/chroot.py +++ b/chroot.py @@ -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) diff --git a/config.py b/config.py index b6ef8bd..12079ea 100644 --- a/config.py +++ b/config.py @@ -447,6 +447,7 @@ config_option = click.option( @click.group(name='config') def cmd_config(): + """Manage the configuration and -profiles""" pass diff --git a/flash.py b/flash.py index f3e16ea..0db175a 100644 --- a/flash.py +++ b/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) diff --git a/forwarding.py b/forwarding.py index 00be1d0..c69daba 100644 --- a/forwarding.py +++ b/forwarding.py @@ -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([ diff --git a/image.py b/image.py index 1ab21c6..3095392 100644 --- a/image.py +++ b/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 diff --git a/packages.py b/packages.py index 7a3a64e..935e03d 100644 --- a/packages.py +++ b/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) diff --git a/ssh.py b/ssh.py index c854273..22c1d46 100644 --- a/ssh.py +++ b/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() diff --git a/telnet.py b/telnet.py index df61a04..d7097fd 100644 --- a/telnet.py +++ b/telnet.py @@ -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',