refactor
This commit is contained in:
parent
c0224aed25
commit
573559e250
1 changed files with 7 additions and 8 deletions
|
|
@ -36,10 +36,12 @@ class SnapperCmd:
|
||||||
self.cmd = ["snapper"]
|
self.cmd = ["snapper"]
|
||||||
if nodbus:
|
if nodbus:
|
||||||
self.cmd.append("--no-dbus")
|
self.cmd.append("--no-dbus")
|
||||||
self.cmd.append(f"--config {config} create")
|
self.cmd.extend([
|
||||||
self.cmd.append(f"--type {snapshot_type}")
|
f"--config {config} create",
|
||||||
self.cmd.append(f"--cleanup-algorithm {cleanup_algorithm}")
|
f"--type {snapshot_type}",
|
||||||
self.cmd.append("--print-number")
|
f"--cleanup-algorithm {cleanup_algorithm}",
|
||||||
|
"--print-number"
|
||||||
|
])
|
||||||
if description:
|
if description:
|
||||||
self.cmd.append(f"--description \"{description}\"")
|
self.cmd.append(f"--description \"{description}\"")
|
||||||
if userdata:
|
if userdata:
|
||||||
|
|
@ -88,10 +90,7 @@ def setup_config_parser(ini_file, parent_cmd, packages):
|
||||||
|
|
||||||
def get_description(snapshot_type, config, section):
|
def get_description(snapshot_type, config, section):
|
||||||
desc_limit = config.getint(section, "desc_limit")
|
desc_limit = config.getint(section, "desc_limit")
|
||||||
if snapshot_type == "pre":
|
return config.get(section, f"{snapshot_type}_description")[:desc_limit]
|
||||||
return config.get(section, "pre_description")[:desc_limit]
|
|
||||||
else:
|
|
||||||
return config.get(section, "post_description")[:desc_limit]
|
|
||||||
|
|
||||||
|
|
||||||
def get_pre_number(snapshot_type, prefile):
|
def get_pre_number(snapshot_type, prefile):
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue