diff --git a/iocage_cli/df.py b/iocage_cli/df.py index faa770f8..35a96b40 100644 --- a/iocage_cli/df.py +++ b/iocage_cli/df.py @@ -60,10 +60,10 @@ def cli(header, _long, _sort): jail_list.sort(key=sort) if header: - jail_list.insert(0, ["NAME", "CRT", "RES", "QTA", "USE", "AVA"]) + table.header(["NAME", "CRT", "RES", "QTA", "USE", "AVA"]) # We get an infinite float otherwise. table.set_cols_dtype(["t", "t", "t", "t", "t", "t"]) - table.add_rows(jail_list) + table.add_rows(jail_list, header=False) ioc_common.logit({"level": "INFO", "message": table.draw()}) else: diff --git a/iocage_cli/snaplist.py b/iocage_cli/snaplist.py index d18c732e..971b116e 100644 --- a/iocage_cli/snaplist.py +++ b/iocage_cli/snaplist.py @@ -43,10 +43,10 @@ def cli(header, jail, _long, _sort): snap_list = ioc.IOCage(jail=jail).snap_list(_long, _sort) if header: - snap_list.insert(0, ["NAME", "CREATED", "RSIZE", "USED"]) + table.header(["NAME", "CREATED", "RSIZE", "USED"]) # We get an infinite float otherwise. table.set_cols_dtype(["t", "t", "t", "t"]) - table.add_rows(snap_list) + table.add_rows(snap_list, header=False) ioc_common.logit({ "level" : "INFO", "message": table.draw() diff --git a/iocage_lib/ioc_common.py b/iocage_lib/ioc_common.py index 8777d91e..fdf8a37a 100644 --- a/iocage_lib/ioc_common.py +++ b/iocage_lib/ioc_common.py @@ -487,19 +487,16 @@ def sort_release(releases, split=False, fetch_releases=False): pass ordered_r_dict = collections.OrderedDict(sorted(r_dict.items())) - index = 0 for r, t in ordered_r_dict.items(): if split: r = r.rsplit('_')[0] # Remove the enumeration if t: - release_list.insert(index, [f"{r}-{t}"]) + release_list.append([f"{r}-{t}"]) else: - release_list.insert(index, [r]) - index += 1 + release_list.append([r]) else: - release_list.insert(index, f"{r}-{t}") - index += 1 + release_list.append(f"{r}-{t}") return release_list diff --git a/iocage_lib/ioc_fstab.py b/iocage_lib/ioc_fstab.py index 6860dd86..761c8785 100644 --- a/iocage_lib/ioc_fstab.py +++ b/iocage_lib/ioc_fstab.py @@ -543,9 +543,8 @@ def fstab_list(self): # We get an infinite float otherwise. table.set_cols_dtype(["t", "t"]) - flat_fstab.insert(0, ["INDEX", "FSTAB ENTRY"]) - - table.add_rows(flat_fstab) + table.header(["INDEX", "FSTAB ENTRY"]) + table.add_rows(flat_fstab, header=False) return table.draw() diff --git a/iocage_lib/ioc_list.py b/iocage_lib/ioc_list.py index 0e6f1b9b..b56c3157 100644 --- a/iocage_lib/ioc_list.py +++ b/iocage_lib/ioc_list.py @@ -178,9 +178,8 @@ def list_all_quick(self, jails): # We get an infinite float otherwise. table.set_cols_dtype(["t", "t"]) - jail_list.insert(0, ["NAME", "IP4"]) - - table.add_rows(jail_list) + table.header(["NAME", "IP4"]) + table.add_rows(jail_list, header=False) return table.draw() @@ -443,23 +442,21 @@ def list_all(self, jails): table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "t", "t", "t", "t"]) - jail_list.insert(0, ["JID", "NAME", "BOOT", "STATE", "TYPE", - "RELEASE", "IP4", "IP6", "TEMPLATE", - "PORTAL", "DOC_URL"]) + table.header(["JID", "NAME", "BOOT", "STATE", "TYPE", "RELEASE", + "IP4", "IP6", "TEMPLATE", "PORTAL", "DOC_URL"]) else: # We get an infinite float otherwise. table.set_cols_dtype(["t", "t", "t", "t", "t", "t", "t", "t", "t", "t"]) - jail_list.insert(0, ["JID", "NAME", "BOOT", "STATE", "TYPE", - "RELEASE", "IP4", "IP6", "TEMPLATE", - 'BASEJAIL']) + table.header(["JID", "NAME", "BOOT", "STATE", "TYPE", "RELEASE", + "IP4", "IP6", "TEMPLATE", 'BASEJAIL']) else: # We get an infinite float otherwise. table.set_cols_dtype(["t", "t", "t", "t", "t"]) - jail_list.insert(0, ["JID", "NAME", "STATE", "RELEASE", "IP4"]) + table.header(["JID", "NAME", "STATE", "RELEASE", "IP4"]) - table.add_rows(jail_list) + table.add_rows(jail_list, header=False) return table.draw() @@ -474,8 +471,8 @@ def list_bases(self, datasets): return flat_base - base_list.insert(0, ["Bases fetched"]) - table.add_rows(base_list) + table.header(["Bases fetched"]) + table.add_rows(base_list, header=False) # We get an infinite float otherwise. table.set_cols_dtype(["t"]) diff --git a/iocage_lib/ioc_plugin.py b/iocage_lib/ioc_plugin.py index 5500f660..9ea6bad1 100644 --- a/iocage_lib/ioc_plugin.py +++ b/iocage_lib/ioc_plugin.py @@ -975,9 +975,9 @@ def fetch_plugin_index( ) for p in plugin_list ] - plugin_list.insert(0, list_header) - table.add_rows(plugin_list) + table.header(list_header) + table.add_rows(plugin_list, header=False) return table.draw()