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

NF: tools/text2filetree.py helper to convert some indented text into our filetree example spec #2014

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yarikoptic
Copy link
Collaborator

See included within script tests

It was produced pretty much fully by just interacting with Claude . chatgpt got stuck on inability to run tests itself (although it did try!).

Original demand came while working on

while transferring examples from google doc (yet to actually use the script on them fully ;) )

…our filetree example spec

See included within script tests
@effigies
Copy link
Collaborator

It seems like a problem that we're round-tripping a text tree into a Python dict and back. It looks like (#807, #837) the goal was just to convert to tree-style and use it consistently.

I don't think the dict approach is very pleasant, and I assume that's why this tool was desired, so I wonder if it would be better to make a custom fence (a la #1794):

```filetree
root
  subdir1
    file1.txt
    subsubdir
      file2.txt
  subdir2
    file3.txt
```

And convert that to:

<pre>
root
├── subdir1
│   ├── file1.txt
│   └── subsubdir
│       └── file2.txt
└── subdir2
    └── file3.txt
</pre>

We could also handle creating a tree from a list of files, e.g.:

```filetree
root/subdir1/file1.txt
root/subdir1/subsubdir/file2.txt
root/subdir2/file3.txt
```

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.

2 participants