diff --git a/src/jlmkr/donor/jlmkr.py b/src/jlmkr/donor/jlmkr.py index ff6163f..a2d531a 100755 --- a/src/jlmkr/donor/jlmkr.py +++ b/src/jlmkr/donor/jlmkr.py @@ -85,22 +85,8 @@ from utils.download import run_lxc_download_script from utils.files import stat_chmod from utils.jail_dataset import get_zfs_dataset, create_zfs_dataset, remove_zfs_dataset - -def get_text_editor(): - def get_from_environ(key): - if editor := os.environ.get(key): - return shutil.which(editor) - - return ( - get_from_environ("VISUAL") - or get_from_environ("EDITOR") - or shutil.which("editor") - or shutil.which("/usr/bin/editor") - or "nano" - ) - - from actions.create import create_jail +from utils.editor import get_text_editor from utils.jail_dataset import jail_is_running diff --git a/src/jlmkr/utils/editor.py b/src/jlmkr/utils/editor.py new file mode 100644 index 0000000..2a652c3 --- /dev/null +++ b/src/jlmkr/utils/editor.py @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: © 2024 Jip-Hop and the Jailmakers +# +# SPDX-License-Identifier: LGPL-3.0-only + +import os +import shutil + + +def get_text_editor(): + def get_from_environ(key): + if editor := os.environ.get(key): + return shutil.which(editor) + + return ( + get_from_environ("VISUAL") + or get_from_environ("EDITOR") + or shutil.which("editor") + or shutil.which("/usr/bin/editor") + or "nano" + )