refactor(script): Differentiate between user-defined and internal vars (#1)

This commit is contained in:
hygienic-books 2023-03-07 00:03:01 +01:00
parent 3277e7a31a
commit c9fcdb5b29

View File

@ -16,6 +16,7 @@ if [[ -r "${conf_file}" ]]; then
source "${conf_file}" source "${conf_file}"
fi fi
# User-defined
if [[ ! "${do_dry_run}" ]]; then do_dry_run='true'; fi if [[ ! "${do_dry_run}" ]]; then do_dry_run='true'; fi
if [[ ! "${important_names}" ]]; then important_names='linux'; fi if [[ ! "${important_names}" ]]; then important_names='linux'; fi
if [[ ! "${snaps_trivial_keep}" ]]; then snaps_trivial_keep='15'; fi if [[ ! "${snaps_trivial_keep}" ]]; then snaps_trivial_keep='15'; fi
@ -31,6 +32,11 @@ if [[ ! "${snap_op_installation_suffix}" ]]; then snap_op_installation_suffix='i
if [[ ! "${snap_op_remove_suffix}" ]]; then snap_op_remove_suffix='rmvl'; fi if [[ ! "${snap_op_remove_suffix}" ]]; then snap_op_remove_suffix='rmvl'; fi
if [[ ! "${snap_op_upgrade_suffix}" ]]; then snap_op_upgrade_suffix='upgr'; fi if [[ ! "${snap_op_upgrade_suffix}" ]]; then snap_op_upgrade_suffix='upgr'; fi
# Internal
declare pkg_separator max_zfs_snapshot_name_length
pkg_separator=':'
max_zfs_snapshot_name_length='255'
function pprint () { function pprint () {
local style msg exit_code local style msg exit_code
style="${1:?}" style="${1:?}"
@ -260,9 +266,8 @@ function main () {
local unabridged_pkg_list_oneline local unabridged_pkg_list_oneline
write_pkg_list_oneline write_pkg_list_oneline
local date_string max_zfs_snapshot_name_length max_dataset_name_length local date_string max_dataset_name_length
date_string="$(date +"${snap_date_format}")" date_string="$(date +"${snap_date_format}")"
max_zfs_snapshot_name_length='255'
find_max_dataset_name_length find_max_dataset_name_length
local trimmed_pkg_list_oneline local trimmed_pkg_list_oneline