Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request]: Rework the --type forest output #20

Closed
MHendricks opened this issue Dec 9, 2022 · 1 comment
Closed

[Request]: Rework the --type forest output #20

MHendricks opened this issue Dec 9, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@MHendricks
Copy link
Member

Description

Split this output into separate requests so you can show just config or distro output.

The config output should be improved so it is easier to read. For example instead of showing the repr hab.parsers.config.Config('not_set/child'), just show the uri, and some other useful information.

These can be very long so it might be nice to make these outputs use something like bash's less if possible.

Solution

No response

Additional Context

No response

@MHendricks MHendricks added the enhancement New feature or request label Dec 9, 2022
@MHendricks
Copy link
Member Author

MHendricks commented Dec 9, 2022

Consistently sort the output.

This works for the existing output:

--- a/hab/__init__.py
+++ b/hab/__init__.py
@@ -174,12 +174,16 @@ class Resolver(object):
     @classmethod
     def dump_forest(cls, forest, style=None):
         """Convert a forest dictionary to a readable string"""
+
+        def mysort(items):
+            return sorted(items, key=lambda item: item.name)
+
         if style is None:
             style = anytree.render.AsciiStyle()
         ret = []
-        for tree_name in sorted(forest):
+        for tree_name in sorted(forest, key=lambda n: n.lower()):
             ret.append(tree_name)
-            tree = str(anytree.RenderTree(forest[tree_name], style))
+            tree = str(anytree.RenderTree(forest[tree_name], style, childiter=mysort))
             for line in tree.split("\n"):
                 ret.append("    {}".format(line))
         return "\n".join(ret)

@MHendricks MHendricks mentioned this issue Apr 11, 2023
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant