Skip to content

Commit a8c94e2

Browse files
authored
Sort options during CLI configuration (#704)
1 parent bb60f78 commit a8c94e2

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

linodecli/configuration/config.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -397,16 +397,21 @@ def configure(
397397
print(f"\nConfiguring {username}\n")
398398

399399
# Configuring Defaults
400-
regions = [
401-
r["id"] for r in _do_get_request(self.base_url, "/regions")["data"]
402-
]
403-
types = [
404-
t["id"]
405-
for t in _do_get_request(self.base_url, "/linode/types")["data"]
406-
]
407-
images = [
408-
i["id"] for i in _do_get_request(self.base_url, "/images")["data"]
409-
]
400+
regions = sorted(
401+
[
402+
r["id"]
403+
for r in _do_get_request(self.base_url, "/regions")["data"]
404+
]
405+
)
406+
types = sorted(
407+
[
408+
t["id"]
409+
for t in _do_get_request(self.base_url, "/linode/types")["data"]
410+
]
411+
)
412+
images = sorted(
413+
[i["id"] for i in _do_get_request(self.base_url, "/images")["data"]]
414+
)
410415

411416
is_full_access = _check_full_access(self.base_url, token)
412417

@@ -423,9 +428,9 @@ def configure(
423428
)
424429

425430
if "data" in users:
426-
auth_users = [
427-
u["username"] for u in users["data"] if "ssh_keys" in u
428-
]
431+
auth_users = sorted(
432+
[u["username"] for u in users["data"] if "ssh_keys" in u]
433+
)
429434

430435
# get the preferred things
431436
config["region"] = _default_thing_input(

0 commit comments

Comments
 (0)