Formatting
This commit is contained in:
parent
1108dbe5be
commit
93267b6ec6
20
jlmkr.py
20
jlmkr.py
|
@ -922,11 +922,12 @@ def get_zfs_dataset(path):
|
||||||
"""
|
"""
|
||||||
Get ZFS dataset path.
|
Get ZFS dataset path.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def clean_field(field):
|
def clean_field(field):
|
||||||
# Put back spaces which were encoded
|
# Put back spaces which were encoded
|
||||||
# https://github.com/openzfs/zfs/issues/11182
|
# https://github.com/openzfs/zfs/issues/11182
|
||||||
return field.replace('\\040', ' ')
|
return field.replace("\\040", " ")
|
||||||
|
|
||||||
path = os.path.realpath(path)
|
path = os.path.realpath(path)
|
||||||
with open("/proc/mounts", "r") as f:
|
with open("/proc/mounts", "r") as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
|
@ -1025,11 +1026,14 @@ def get_text_editor():
|
||||||
if editor := os.environ.get(key):
|
if editor := os.environ.get(key):
|
||||||
return shutil.which(editor)
|
return shutil.which(editor)
|
||||||
|
|
||||||
return get_from_environ("VISUAL") \
|
return (
|
||||||
or get_from_environ("EDITOR") \
|
get_from_environ("VISUAL")
|
||||||
or shutil.which("editor") \
|
or get_from_environ("EDITOR")
|
||||||
or shutil.which("/usr/bin/editor") \
|
or shutil.which("editor")
|
||||||
|
or shutil.which("/usr/bin/editor")
|
||||||
or "nano"
|
or "nano"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def interactive_config():
|
def interactive_config():
|
||||||
config = KeyValueParser()
|
config = KeyValueParser()
|
||||||
|
@ -1517,9 +1521,7 @@ def edit_jail(jail_name):
|
||||||
|
|
||||||
jail_config_path = get_jail_config_path(jail_name)
|
jail_config_path = get_jail_config_path(jail_name)
|
||||||
|
|
||||||
returncode = subprocess.run(
|
returncode = subprocess.run([get_text_editor(), jail_config_path]).returncode
|
||||||
[get_text_editor(), jail_config_path]
|
|
||||||
).returncode
|
|
||||||
|
|
||||||
if returncode != 0:
|
if returncode != 0:
|
||||||
eprint(f"An error occurred while editing {jail_config_path}.")
|
eprint(f"An error occurred while editing {jail_config_path}.")
|
||||||
|
|
Loading…
Reference in New Issue