forked from Mirror/pmbootstrap
Fix types of pmb arguments (MR 2370)
- Change some arguments' types to bool to avoid type mismatch errors after refactoring in the future - Add more arguments from parse/arguments with corresponding types - Change type of pmbootstrap log --lines argument to int
This commit is contained in:
parent
b98c5e2cab
commit
b8ca63dc2d
3 changed files with 58 additions and 45 deletions
|
@ -64,7 +64,7 @@ def run_command(args: PmbArgs):
|
||||||
command: Command
|
command: Command
|
||||||
# Would be nice to use match case but we support Python 3.8
|
# Would be nice to use match case but we support Python 3.8
|
||||||
if args.action == "log":
|
if args.action == "log":
|
||||||
command = Log(args.clear_log, int(args.lines))
|
command = Log(args.clear_log, args.lines)
|
||||||
elif args.action == "index":
|
elif args.action == "index":
|
||||||
# FIXME: should index support --arch?
|
# FIXME: should index support --arch?
|
||||||
command = Index()
|
command = Index()
|
||||||
|
|
|
@ -961,7 +961,7 @@ def get_parser():
|
||||||
|
|
||||||
# Action: log
|
# Action: log
|
||||||
log = sub.add_parser("log", help="follow the pmbootstrap logfile")
|
log = sub.add_parser("log", help="follow the pmbootstrap logfile")
|
||||||
log.add_argument("-n", "--lines", default="60", help="count of initial output lines")
|
log.add_argument("-n", "--lines", type=int, default=60, help="count of initial output lines")
|
||||||
log.add_argument("-c", "--clear", help="clear the log", action="store_true", dest="clear_log")
|
log.add_argument("-c", "--clear", help="clear the log", action="store_true", dest="clear_log")
|
||||||
|
|
||||||
# Action: zap
|
# Action: zap
|
||||||
|
|
99
pmb/types.py
99
pmb/types.py
|
@ -38,20 +38,21 @@ class PmbArgs(Namespace):
|
||||||
action_test: str
|
action_test: str
|
||||||
add: str
|
add: str
|
||||||
all: bool
|
all: bool
|
||||||
all_git: str
|
all_git: bool
|
||||||
all_stable: str
|
all_stable: bool
|
||||||
android_recovery_zip: str
|
android_recovery_zip: bool
|
||||||
apkindex_path: Path
|
apkindex_path: Path
|
||||||
aports: Optional[list[Path]]
|
aports: Optional[list[Path]]
|
||||||
arch: Optional[Arch]
|
arch: Optional[Arch]
|
||||||
as_root: str
|
as_root: bool
|
||||||
assume_yes: str
|
assume_yes: bool
|
||||||
auto: str
|
auto: bool
|
||||||
autoinstall: str
|
autoinstall: bool
|
||||||
boot_size: str
|
boot_size: str
|
||||||
build_default_device_arch: str
|
build_default_device_arch: str
|
||||||
buildroot: str
|
buildroot: str
|
||||||
built: str
|
built: bool
|
||||||
|
ccache: bool
|
||||||
ccache_size: str
|
ccache_size: str
|
||||||
cipher: str
|
cipher: str
|
||||||
clear_log: bool
|
clear_log: bool
|
||||||
|
@ -64,54 +65,61 @@ class PmbArgs(Namespace):
|
||||||
deviceinfo_parse_kernel: str
|
deviceinfo_parse_kernel: str
|
||||||
devices: str
|
devices: str
|
||||||
disk: Path
|
disk: Path
|
||||||
dry: str
|
dry: bool
|
||||||
efi: str
|
efi: bool
|
||||||
envkernel: str
|
envkernel: bool
|
||||||
export_folder: Path
|
export_folder: Path
|
||||||
extra_space: str
|
extra_space: str
|
||||||
fast: str
|
fast: bool
|
||||||
file: str
|
file: str
|
||||||
filesystem: str
|
filesystem: str
|
||||||
flash_method: str
|
flash_method: str
|
||||||
folder: str
|
folder: str
|
||||||
force: bool
|
force: bool
|
||||||
fork_alpine: bool
|
fork_alpine: bool
|
||||||
full_disk_encryption: str
|
fork_alpine_retain_branch: bool
|
||||||
|
full_disk_encryption: bool
|
||||||
|
go_mod_cache: bool
|
||||||
hook: str
|
hook: str
|
||||||
host: str
|
host: str
|
||||||
host_qemu: str
|
host_qemu: bool
|
||||||
|
http: bool
|
||||||
|
ignore_depends: bool
|
||||||
image_size: str
|
image_size: str
|
||||||
image: bool
|
image: bool
|
||||||
install_base: str
|
install_base: bool
|
||||||
install_blockdev: str
|
install_blockdev: bool
|
||||||
install_cgpt: str
|
install_cgpt: bool
|
||||||
install_key: bool
|
install_key: bool
|
||||||
install_local_pkgs: str
|
install_local_pkgs: bool
|
||||||
install_recommends: str
|
install_recommends: bool
|
||||||
is_default_channel: str
|
is_default_channel: str
|
||||||
iter_time: str
|
iter_time: str
|
||||||
jobs: str
|
jobs: str
|
||||||
kconfig_check_details: str
|
kconfig_check_details: bool
|
||||||
kernel: str
|
kernel: str
|
||||||
keymap: str
|
keymap: str
|
||||||
lines: str
|
lines: int
|
||||||
log: Path
|
log: Path
|
||||||
mirror_alpine: str
|
mirror_alpine: str
|
||||||
mirror_postmarketos: str
|
mirror_postmarketos: str
|
||||||
name: str
|
name: str
|
||||||
no_depends: str
|
nconfig: bool
|
||||||
no_fde: str
|
netboot: bool
|
||||||
|
no_depends: bool
|
||||||
|
no_fde: bool
|
||||||
no_firewall: bool
|
no_firewall: bool
|
||||||
no_image: str
|
no_image: bool
|
||||||
|
no_reboot: bool
|
||||||
|
no_sshd: bool
|
||||||
non_existing: str
|
non_existing: str
|
||||||
no_reboot: str
|
odin_flashable_tar: bool
|
||||||
no_sshd: str
|
|
||||||
odin_flashable_tar: str
|
|
||||||
offline: bool
|
offline: bool
|
||||||
|
on_device_installer: bool
|
||||||
ondev_cp: list[tuple[str, str]]
|
ondev_cp: list[tuple[str, str]]
|
||||||
on_device_installer: str
|
ondev_no_rootfs: bool
|
||||||
ondev_no_rootfs: str
|
output: str
|
||||||
overview: str
|
overview: bool
|
||||||
# FIXME (#2324): figure out the args.package vs args.packages situation
|
# FIXME (#2324): figure out the args.package vs args.packages situation
|
||||||
package: str | list[str]
|
package: str | list[str]
|
||||||
packages: list[str]
|
packages: list[str]
|
||||||
|
@ -120,39 +128,44 @@ class PmbArgs(Namespace):
|
||||||
path: Path
|
path: Path
|
||||||
pkgname: str
|
pkgname: str
|
||||||
pkgname_pkgver_srcurl: str
|
pkgname_pkgver_srcurl: str
|
||||||
|
pkgs_local: bool
|
||||||
|
pkgs_local_mismatch: bool
|
||||||
|
pkgs_online_mismatch: bool
|
||||||
port: str
|
port: str
|
||||||
qemu_audio: str
|
qemu_audio: str
|
||||||
qemu_cpu: str
|
qemu_cpu: str
|
||||||
qemu_display: str
|
qemu_display: str
|
||||||
qemu_gl: str
|
qemu_gl: bool
|
||||||
qemu_kvm: str
|
qemu_kvm: bool
|
||||||
qemu_redir_stdio: str
|
qemu_redir_stdio: str
|
||||||
qemu_tablet: str
|
qemu_tablet: bool
|
||||||
qemu_video: str
|
qemu_video: str
|
||||||
recovery_flash_kernel: str
|
recovery_flash_kernel: bool
|
||||||
recovery_install_partition: str
|
recovery_install_partition: str
|
||||||
ref: str
|
ref: str
|
||||||
replace: bool
|
replace: bool
|
||||||
repository: str
|
repository: str
|
||||||
reset: str
|
reset: bool
|
||||||
resume: str
|
resume: bool
|
||||||
rootfs: str
|
rootfs: bool
|
||||||
rsync: str
|
rsync: bool
|
||||||
scripts: str
|
scripts: str
|
||||||
second_storage: str
|
second_storage: str
|
||||||
selected_providers: dict[str, str]
|
selected_providers: dict[str, str]
|
||||||
sparse: str
|
sparse: bool
|
||||||
split: bool
|
split: bool
|
||||||
src: str
|
src: str
|
||||||
ssh_keys: str
|
ssh_keys: str
|
||||||
strict: str
|
strict: bool
|
||||||
sudo_timer: bool
|
sudo_timer: bool
|
||||||
suffix: str
|
suffix: str
|
||||||
systemd: str
|
systemd: str
|
||||||
timeout: float
|
timeout: float
|
||||||
|
user: str
|
||||||
value: str
|
value: str
|
||||||
verbose: bool
|
verbose: bool
|
||||||
verify: str
|
verify: bool
|
||||||
work: Path
|
work: Path
|
||||||
xauth: str
|
xauth: bool
|
||||||
zap: str
|
xconfig: bool
|
||||||
|
zap: bool
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue