From d7a45f23d4395d2ba07e4829c0ea9617268d9990 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 19 Sep 2024 04:26:28 +0200 Subject: [PATCH] Update a few things --- completions/virtme-ng.fish | 366 ++++++++++++++++++++++++++++++++++ config.fish | 1 + functions/lsusb.fish | 4 + functions/ntfy.fish | 14 ++ functions/python-publish.fish | 2 +- 5 files changed, 386 insertions(+), 1 deletion(-) create mode 100644 completions/virtme-ng.fish create mode 100644 functions/lsusb.fish create mode 100644 functions/ntfy.fish diff --git a/completions/virtme-ng.fish b/completions/virtme-ng.fish new file mode 100644 index 0000000..883b57b --- /dev/null +++ b/completions/virtme-ng.fish @@ -0,0 +1,366 @@ +function seen_option_any + for token in (commandline \ + --tokenize \ + --current-process) + if contains \ + -- "$token" $argv + return 0 + end + end + + return 1 +end + +complete \ + --command='virtme-ng' \ + --short-option="h" \ + --long-option="help" \ + --exclusive \ + --description="Show help message and exit" + +complete \ + --command='virtme-ng' \ + --short-option="V" \ + --long-option="version" \ + --exclusive \ + --description="Show program's version and exit" \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option="dry-run" \ + --description="Only show the commands without actually running them" \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option="no-virtme-ng-init" \ + --description="Fallback to the bash virtme-init" \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='gdb' \ + --description='Attach a debugging session to running instance' \ + --condition='__fish_seen_argument -l debug' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='snaps' \ + --description='Allow to execute snaps inside virtme-ng' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='debug' \ + --description='Start the instance with debugging enabled' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='skip-modules' \ + --short-option='S' \ + --description='Skip external modules' \ + --condition='__fish_seen_argument -s b -l build' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='commit' \ + --short-option='c' \ + --description='Use a kernel identified by a specific commit id, tag or branch' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='config' \ + --short-option='f' \ + --condition='__fish_seen_argument -s b -l build' \ + --description='Use specific kernel .config override file' + +complete \ + --command='virtme-ng' \ + --long-option='configitem' \ + --description='Override a single .config item' \ + --condition='__fish_seen_argument -s b -l build' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='busybox' \ + --description='Use the specified busybox binary' + +complete \ + --command='virtme-ng' \ + --long-option='qemu' \ + --description='Use the specified QEMU binary' \ + --condition='__fish_seen_argument -s r -l run' + +complete \ + --command='virtme-ng' \ + --long-option='name' \ + --description='Set guest hostname' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='user' \ + --description='Change user inside the guest' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files \ + --arguments='(__fish_complete_users)' + +complete \ + --command='virtme-ng' \ + --long-option='root' \ + --description='Pass a specific chroot to use inside the virtualized kernel' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files \ + --arguments='(__fish_complete_directories .)' + +complete \ + --command='virtme-ng' \ + --long-option='root-release' \ + --description='Use a target Ubuntu release to create a new chroot' \ + --condition='__fish_seen_argument -l root' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='rw' \ + --description='Give the guest read-write access to its root filesystem' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='force-9p' \ + --description='Use legacy 9p filesystem as rootfs' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='disable-microvm' \ + --description='Avoid using the "microvm" QEMU architecture (only on x86_64)' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='disable-kvm' \ + --description='Avoid using hardware virtualization / KVM' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='cwd' \ + --description='Change guest working directory' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files \ + --arguments='(__fish_complete_directories .)' + +complete \ + --command='virtme-ng' \ + --long-option='rodir' \ + --description='Supply a read-only directory to the guest' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files \ + --arguments='(__fish_complete_directories .)' + +complete \ + --command='virtme-ng' \ + --long-option='rwdir' \ + --description='Supply a read/write directory to the guest' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files \ + --arguments='(__fish_complete_directories .)' + +complete \ + --command='virtme-ng' \ + --long-option='overlay-rwdir' \ + --description='Supply a directory that is r/w to the guest but read-only in the host' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files \ + --arguments='(__fish_complete_directories .)' + +complete \ + --command='virtme-ng' \ + --long-option='cpus' \ + --short-option='p' \ + --description='Set guest CPU count' \ + --condition='__fish_seen_argument -s r -l run' + +complete \ + --command='virtme-ng' \ + --long-option='memory' \ + --short-option='m' \ + --description='Set guest memory size' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='numa' \ + --description='Create a NUMA node in the guest' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='balloon' \ + --description='Allow the host to ask the guest to release memory' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='network' \ + --short-option='n' \ + --description='Enable network access' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='disk' \ + --short-option='D' \ + --description='Add a file as virtio-scsi disk' \ + --condition='__fish_seen_argument -s r -l run' + +complete \ + --command='virtme-ng' \ + --long-option='exec' \ + --short-option='e' \ + --description='Execute a command inside the kernel and exit' \ + --condition='__fish_seen_argument -s r -l run' + +complete \ + --command='virtme-ng' \ + --long-option='append' \ + --short-option='a' \ + --description='Additional kernel boot options' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='force-initramfs' \ + --description='Use an initramfs even if unnecessary' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='sound' \ + --description='Enable audio device' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='graphics' \ + --short-option='g' \ + --description='Show graphical output instead of using a console' \ + --condition='__fish_seen_argument -s r -l run' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='verbose' \ + --short-option='v' \ + --description='Increase console output verbosity' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='quiet' \ + --short-option='q' \ + --description='Decrease console output verbosity' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='qemu-opts' \ + --short-option='o' \ + --description='Additional arguments for QEMU' \ + --condition='__fish_seen_argument -s r -l run' + +complete \ + --command='virtme-ng' \ + --long-option='build-host' \ + --description='Perform kernel build on a remote server' \ + --condition='__fish_seen_argument -s b -l build' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='build-host-exec-prefix' \ + --description='Prepend a command to the make command executed on the remote build host' \ + --condition='__fish_seen_argument -l build-host' + +complete \ + --command='virtme-ng' \ + --long-option='build-host-vmlinux' \ + --description='Copy vmlinux back from the build host' \ + --condition='__fish_seen_argument -l build-host' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='arch' \ + --description='Generate and test a kernel for a specific architecture' \ + --condition='__fish_seen_argument -s r -l run -s b -l build' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='cross-compile' \ + --description='Set cross-compile prefix' \ + --condition='__fish_seen_argument -s b -l build' + +complete \ + --command='virtme-ng' \ + --long-option='force' \ + --description='Force reset git repository to target branch or commit and force kernel config override' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='kconfig' \ + --short-option='k' \ + --description='Only override the kernel .config without building/running anything' + +complete \ + --command='virtme-ng' \ + --long-option='run' \ + --short-option='r' \ + --description='Run a specific kernel' + +complete \ + --command='virtme-ng' \ + --long-option='build' \ + --short-option='b' \ + --description='Build the kernel in the current directory (or remotely if used with \ + --build-host)' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='clean' \ + --short-option='x' \ + --description='Clean the kernel repository (local or remote if used with \ + --build-host)' \ + --no-files + +complete \ + --command='virtme-ng' \ + --long-option='dump' \ + --short-option='d' \ + --description='Generate a memory dump of the running kernel' \ + --no-files + diff --git a/config.fish b/config.fish index a907810..7bdc376 100644 --- a/config.fish +++ b/config.fish @@ -17,4 +17,5 @@ set -U "fish_color_escape" "green" set -U "fish_color_autosuggestion" "brblack" set -U "fish_color_cancel" "white" "--background=brred" +# Logging level set -U "DOTFISH_LOG_LEVEL" "50" diff --git a/functions/lsusb.fish b/functions/lsusb.fish new file mode 100644 index 0000000..3057df4 --- /dev/null +++ b/functions/lsusb.fish @@ -0,0 +1,4 @@ +function lsusb --wraps=cyme --wraps='cyme --headings --tree' --description 'alias lsusb cyme --headings --tree' + cyme --headings --tree $argv + +end diff --git a/functions/ntfy.fish b/functions/ntfy.fish new file mode 100644 index 0000000..c945276 --- /dev/null +++ b/functions/ntfy.fish @@ -0,0 +1,14 @@ +which ntfy --skip-functions >/dev/null 2>/dev/null +if [ $status -eq 0 ] + function ntfy + set topic $argv[1] + set data $argv[2..-1] + + log-t "Sending notification to" "$topic" "..." + + curl \ + "https://ntfy.steffo.eu/$topic" \ + --header "Authorization: Bearer $NTFY_TOKEN" \ + --data "$data" + end +end diff --git a/functions/python-publish.fish b/functions/python-publish.fish index 87d1298..39a86f2 100644 --- a/functions/python-publish.fish +++ b/functions/python-publish.fish @@ -1,6 +1,6 @@ which uvx --skip-functions >/dev/null 2>/dev/null if [ $status -eq 0 ] function python-publish - uvx twine upload --non-interactive --verbose --username "Steffo" dist/* + uvx twine upload --verbose --config-file ~"/.pypirc" --username Steffo dist/* end end