Skip to content

Conversation

@kradalby
Copy link
Collaborator

@kradalby kradalby commented Dec 9, 2025

This commit changes lists in cli to be new line instead of commas, making them easier to read when they are large.

Also adds a separator between items in tables with multi lines list.

Fixes #2612

@kradalby kradalby requested a review from juanfont as a code owner December 9, 2025 12:22
@nblock
Copy link
Collaborator

nblock commented Dec 10, 2025

I'm unsure about this specific implementation. It improves readability for headscale nodes list-routes with many routes but headscale nodes list, headscale preauthkeys list -u 1 are just one line per record and are now cluttered with ---…. which makes them hard to read:

headscale preauthkeys list -u 1
ID | Key/Prefix                                       | Reusable | Ephemeral | Used  | Expiration          | Created             | Tags
1  | a23XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | false    | true      | false | 2022-02-26 17:11:15 | 2022-02-26 17:02:32 |
---------------------------------------------------------------------------------------------------------------------------------------
2  | 9d8XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | false    | true      | true  | 2022-02-26 17:11:18 | 2022-02-26 17:08:07 |
---------------------------------------------------------------------------------------------------------------------------------------
3  | ef0XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | false    | false     | true  | 2022-02-26 17:16:54 | 2022-02-26 17:11:54 |
---------------------------------------------------------------------------------------------------------------------------------------
[snipped]

Can we remove the horizontal line for all tables? I think the formatting with be good enough, Would look something like this:

headscale nodes list-routes
ID | Hostname | Approved              | Available             | Serving (Primary)
14 | node1    | 0.0.0.0/0             | 0.0.0.0/0             | 0.0.0.0/0
   |          | ::/0                  | ::/0                  | ::/0
31 | node2    | 10.1.0.0/16           | 10.1.0.0/16           |
   |          | 10.5.0.0/16           | 10.5.0.0/16           |
   |          | 10.26.0.0/16          | 10.26.0.0/16          |
   |          | 10.48.0.0/16          | 10.48.0.0/16          |
   |          | 10.49.0.0/16          | 10.49.0.0/16          |
   |          | 10.101.0.0/16         | 10.101.0.0/16         |
   |          | 10.102.0.0/16         | 10.102.0.0/16         |
   |          | 10.149.0.0/16         | 10.149.0.0/16         |
   |          | 10.200.0.0/16         | 10.200.0.0/16         |
   |          | 10.236.0.0/16         | 10.236.0.0/16         |
   |          | 10.237.0.0/16         | 10.237.0.0/16         |
   |          | 10.238.0.0/16         | 10.238.0.0/16         |
   |          | 172.23.1.9/32         | 172.23.1.9/32         |
   |          | 172.23.1.13/32        | 172.23.1.13/32        |
33 | node3    | 192.168.81.0/24       | 192.168.81.0/24       |
   |          | 192.168.82.0/24       | 192.168.82.0/24       |
   |          | 192.168.83.0/24       | 192.168.83.0/24       |

Or keep the horizontal lines just for headscale nodes list-routes and remove it for all others where output is just one line per record?

headscale nodes list-routes
ID | Hostname | Approved              | Available             | Serving (Primary)
14 | node1    | 0.0.0.0/0             | 0.0.0.0/0             | 0.0.0.0/0
   |          | ::/0                  | ::/0                  | ::/0
---------------------------------------------------------------------------------
31 | node2    | 10.1.0.0/16           | 10.1.0.0/16           |
   |          | 10.5.0.0/16           | 10.5.0.0/16           |
   |          | 10.26.0.0/16          | 10.26.0.0/16          |
   |          | 10.48.0.0/16          | 10.48.0.0/16          |
   |          | 10.49.0.0/16          | 10.49.0.0/16          |
   |          | 10.101.0.0/16         | 10.101.0.0/16         |
   |          | 10.102.0.0/16         | 10.102.0.0/16         |
   |          | 10.149.0.0/16         | 10.149.0.0/16         |
   |          | 10.200.0.0/16         | 10.200.0.0/16         |
   |          | 10.236.0.0/16         | 10.236.0.0/16         |
   |          | 10.237.0.0/16         | 10.237.0.0/16         |
   |          | 10.238.0.0/16         | 10.238.0.0/16         |
   |          | 172.23.1.9/32         | 172.23.1.9/32         |
   |          | 172.23.1.13/32        | 172.23.1.13/32        |
---------------------------------------------------------------------------------
33 | node3    | 192.168.81.0/24       | 192.168.81.0/24       |
   |          | 192.168.82.0/24       | 192.168.82.0/24       |
   |          | 192.168.83.0/24       | 192.168.83.0/24       |

@kradalby kradalby force-pushed the kradalby/route-cli-style branch from 614e828 to e305ca4 Compare December 10, 2025 10:14
This commit changes lists in cli to be new line instead of commas, making
them easier to read when they are large.

Also adds a separator between items in tables with multi lines list.

Fixes juanfont#2612

Signed-off-by: Kristoffer Dalby <[email protected]>
@kradalby kradalby force-pushed the kradalby/route-cli-style branch from e305ca4 to 51917e2 Compare December 10, 2025 10:38
@kradalby kradalby merged commit f3f2d30 into juanfont:main Dec 10, 2025
126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

V0.26 Route List formatting

2 participants