From 5a88d127d69882010c4ef1dcbc384bd24998977d Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 1 Feb 2025 01:30:54 +0100 Subject: [PATCH 01/10] lint/return --- sh/lint/lint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/lint/lint.sh b/sh/lint/lint.sh index 5448563..3240fd0 100644 --- a/sh/lint/lint.sh +++ b/sh/lint/lint.sh @@ -1,7 +1,7 @@ # lint code rwx_lint() { local path="${1}" - [ -n "${path}" ] || exit 1 + [ -n "${path}" ] || return 1 rwx_lint_clean set \ "python" \ @@ -17,7 +17,7 @@ rwx_lint() { # clean rwx_lint_clean() { local path="${1}" - [ -n "${path}" ] || exit 1 + [ -n "${path}" ] || return 1 rwx_log "py3clean" py3clean \ --verbose \ From a98294a65ee18b2d1516a664ed33da6f01c9d2c1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 1 Feb 2025 01:32:33 +0100 Subject: [PATCH 02/10] fix --- sh/lint/lint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sh/lint/lint.sh b/sh/lint/lint.sh index 3240fd0..b0d9909 100644 --- a/sh/lint/lint.sh +++ b/sh/lint/lint.sh @@ -2,7 +2,7 @@ rwx_lint() { local path="${1}" [ -n "${path}" ] || return 1 - rwx_lint_clean + rwx_lint_clean "${path}" set \ "python" \ "shell" @@ -11,7 +11,7 @@ rwx_lint() { rwx_log "${code}" "rwx_lint_${code}" "${path}" done - rwx_lint_clean + rwx_lint_clean "${path}" } # clean From 459e85de929e277e00da51fa214f627a15541f94 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 1 Feb 2025 01:38:15 +0100 Subject: [PATCH 03/10] tasks/after --- sh/lint/lint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sh/lint/lint.sh b/sh/lint/lint.sh index b0d9909..6aa96b4 100644 --- a/sh/lint/lint.sh +++ b/sh/lint/lint.sh @@ -3,6 +3,7 @@ rwx_lint() { local path="${1}" [ -n "${path}" ] || return 1 rwx_lint_clean "${path}" + rwx_lint_tasks "${path}" set \ "python" \ "shell" @@ -71,6 +72,7 @@ rwx_lint_tasks() { for type in "${@}"; do rwx_log "${type}" grep \ + --after "1" \ --directories "recurse" \ --line-number \ " ${type}" \ From 2c0d6050efbaeaac84fd61f28bb512760e3bea28 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 1 Feb 2025 01:47:12 +0100 Subject: [PATCH 04/10] log/"" --- sh/lint/lint.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sh/lint/lint.sh b/sh/lint/lint.sh index 6aa96b4..6cd7533 100644 --- a/sh/lint/lint.sh +++ b/sh/lint/lint.sh @@ -9,7 +9,7 @@ rwx_lint() { "shell" local code for code in "${@}"; do - rwx_log "${code}" + rwx_log "" "${code}" "rwx_lint_${code}" "${path}" done rwx_lint_clean "${path}" @@ -19,7 +19,7 @@ rwx_lint() { rwx_lint_clean() { local path="${1}" [ -n "${path}" ] || return 1 - rwx_log "py3clean" + rwx_log "" "py3clean" py3clean \ --verbose \ "${path}" @@ -28,7 +28,7 @@ rwx_lint_clean() { "ruff" local tool for tool in "${@}"; do - rwx_log "${tool}" + rwx_log "" "${tool}" rwx_remove "${path}/.${tool}_cache" done } @@ -43,7 +43,7 @@ rwx_lint_python() { "mypy" \ "ruff" for action in "${@}"; do - rwx_log "${action}" + rwx_log "" "${action}" "rwx_${action}" "${path}" done } @@ -56,7 +56,7 @@ rwx_lint_shell() { "shellcheck" \ "shfmt" for action in "${@}"; do - rwx_log "${action}" + rwx_log "" "${action}" "rwx_${action}" "${path}" done } @@ -70,7 +70,7 @@ rwx_lint_tasks() { "TODO" \ "FIXME" for type in "${@}"; do - rwx_log "${type}" + rwx_log "" "${type}" grep \ --after "1" \ --directories "recurse" \ From bd35b13f73d1e69cc6a4cbe0a083c79f743751f2 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 3 Feb 2025 19:15:34 +0100 Subject: [PATCH 05/10] future --- rwx/grub/__init__.py | 2 ++ rwx/ps/__init__.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/rwx/grub/__init__.py b/rwx/grub/__init__.py index 572b13e..aa208c3 100644 --- a/rwx/grub/__init__.py +++ b/rwx/grub/__init__.py @@ -1,5 +1,7 @@ """Wrap GRUB commands.""" +from __future__ import annotations + from rwx import cmd, ps cmd.need("grub-mkimage") diff --git a/rwx/ps/__init__.py b/rwx/ps/__init__.py index 81d2320..3bef50d 100644 --- a/rwx/ps/__init__.py +++ b/rwx/ps/__init__.py @@ -1,5 +1,7 @@ """Handle processes.""" +from __future__ import annotations + import subprocess from rwx import Object, txt From 024172af9d81c5e758c76dc144a1d056962a83e0 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 3 Feb 2025 19:21:15 +0100 Subject: [PATCH 06/10] members --- sh/rescue/hetzner.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sh/rescue/hetzner.sh b/sh/rescue/hetzner.sh index 9d22847..24d6bd0 100644 --- a/sh/rescue/hetzner.sh +++ b/sh/rescue/hetzner.sh @@ -63,6 +63,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members="${members} ${device}2" done + # LATER alternative + # shellcheck disable=SC2086 rwx_fs_raid_create \ "boot" "00000000:00000000:00000000:00000002" ${members} # @@ -87,6 +89,8 @@ rwx_rescue_wipe_0_init_hetzner_8_8() { for device in "${@}"; do members="${members} ${device}1" done + # LATER alternative + # shellcheck disable=SC2086 rwx_fs_raid_create \ "crypt" "00000000:00000000:00000000:00000001" ${members} # encrypt From 3ef93255e9c441dd36084ea19c060beeb5e62b86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 3 Feb 2025 19:29:02 +0100 Subject: [PATCH 07/10] ffmpeg --- sh/ffmpeg.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sh/ffmpeg.sh b/sh/ffmpeg.sh index 57f9d21..ed20d40 100644 --- a/sh/ffmpeg.sh +++ b/sh/ffmpeg.sh @@ -145,6 +145,8 @@ rwx_ffmpeg_output_video_slow() { rwx_ffmpeg_record_hdmi_precision() { local file="${1}" [ -n "${file}" ] || return + # shellcheck disable=SC2046,SC2312 + # LATER alternative set -- \ $(rwx_ffmpeg_input_hdmi) \ $(rwx_ffmpeg_input_dell_precision) \ @@ -158,6 +160,8 @@ rwx_ffmpeg_record_hdmi_precision() { rwx_ffmpeg_record_hdmi_yeti() { local file="${1}" [ -n "${file}" ] || return + # shellcheck disable=SC2046,SC2312 + # LATER alternative set -- \ $(rwx_ffmpeg_input_hdmi) \ $(rwx_ffmpeg_input_blue_yeti) \ @@ -178,6 +182,8 @@ rwx_ffmpeg_reduce() { local from="${3}" local to="${4}" [ -n "${output}" ] || return + # shellcheck disable=SC2046,SC2312 + # LATER alternative set -- \ $(rwx_ffmpeg_input_file "${input}" "${from}" "${to}") \ $(rwx_ffmpeg_output_video_slow) \ From aaba7cbcc6f162633e2637da0fac7eda7c7efdcf Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 3 Feb 2025 19:38:50 +0100 Subject: [PATCH 08/10] =?UTF-8?q?=E2=86=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sh/ffmpeg.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sh/ffmpeg.sh b/sh/ffmpeg.sh index ed20d40..bcb3a62 100644 --- a/sh/ffmpeg.sh +++ b/sh/ffmpeg.sh @@ -145,8 +145,8 @@ rwx_ffmpeg_output_video_slow() { rwx_ffmpeg_record_hdmi_precision() { local file="${1}" [ -n "${file}" ] || return - # shellcheck disable=SC2046,SC2312 # LATER alternative + # shellcheck disable=SC2046,SC2312 set -- \ $(rwx_ffmpeg_input_hdmi) \ $(rwx_ffmpeg_input_dell_precision) \ @@ -160,8 +160,8 @@ rwx_ffmpeg_record_hdmi_precision() { rwx_ffmpeg_record_hdmi_yeti() { local file="${1}" [ -n "${file}" ] || return - # shellcheck disable=SC2046,SC2312 # LATER alternative + # shellcheck disable=SC2046,SC2312 set -- \ $(rwx_ffmpeg_input_hdmi) \ $(rwx_ffmpeg_input_blue_yeti) \ @@ -182,8 +182,8 @@ rwx_ffmpeg_reduce() { local from="${3}" local to="${4}" [ -n "${output}" ] || return - # shellcheck disable=SC2046,SC2312 # LATER alternative + # shellcheck disable=SC2046,SC2312 set -- \ $(rwx_ffmpeg_input_file "${input}" "${from}" "${to}") \ $(rwx_ffmpeg_output_video_slow) \ From 7668ef8f47467facc2f966ff77c2fd043d06a7db Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 3 Feb 2025 19:42:09 +0100 Subject: [PATCH 09/10] lint/clean --- sh/lint/lint.sh | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/sh/lint/lint.sh b/sh/lint/lint.sh index 6cd7533..365773f 100644 --- a/sh/lint/lint.sh +++ b/sh/lint/lint.sh @@ -19,16 +19,13 @@ rwx_lint() { rwx_lint_clean() { local path="${1}" [ -n "${path}" ] || return 1 - rwx_log "" "py3clean" - py3clean \ - --verbose \ - "${path}" + rwx_log "" "clean" "" + py3clean "${path}" set \ "mypy" \ "ruff" local tool for tool in "${@}"; do - rwx_log "" "${tool}" rwx_remove "${path}/.${tool}_cache" done } From e511ffa7f7c102fe0244d9babe13c274f04ba240 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 7 Feb 2025 21:39:13 +0100 Subject: [PATCH 10/10] python/venv --- sh/python.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 sh/python.sh diff --git a/sh/python.sh b/sh/python.sh new file mode 100644 index 0000000..44ea181 --- /dev/null +++ b/sh/python.sh @@ -0,0 +1,14 @@ +# ╭────────╮ +# │ python │ +# ╰────────╯ + +# ╭────────┬──────╮ +# │ python │ venv │ +# ╰────────┴──────╯ + +rwx_python_venv() { + local path="${1}" + [ -d "${path}" ] || return 1 + export VIRTUAL_ENV="${path}" && \ + export PATH="${VIRTUAL_ENV}/bin:${PATH}" +}