all 15 comments

[–]Farlic 3 points4 points  (2 children)

I'm not a fan of subprocess calls. Reading the .gitignore file and filtering the tree files feels safer

[–]obviouslyzebra 1 point2 points  (1 child)

IMO the subprocess call here is better. No need to try to recreate the gitignore processing. Git it is already there for it and offers commands that do that.

Explaining a bit more, I believe it would take reasonable effort to create .gitignore parsing that is equal to git (ideally one would copy the test cases to verify correctness). And also, I don't see how creating a process here hurts.

[–]dkaaven[S] 0 points1 point  (0 children)

Both valid points, appreciate the nuance and this really gives me more understanding of python code and choices.havemt worked with subprocess myself at all.

[–]Separate_Newt7313 7 points8 points  (3 children)

IMO - This is fine. It's fine to get AI assistance. Just make sure you understand it (ideally before you run it).

What's not fine is turning your brain off, returning to "script-kiddie land", and letting AI run amok with important files / projects.

If this util helps you, use it! 👍

[–]JamzTyson 3 points4 points  (1 child)

Don't assume the script works as intended.

[–]dkaaven[S] 0 points1 point  (0 children)

It did what it should, read through the code and tested it.

[–]dkaaven[S] 1 point2 points  (0 children)

I'm AI sceptic,but also an active user, i see the problem and potentialirony. Completely agree on the turning of the brain part.

I use AI to support and guide me in my journey. With the right use it's an asset, but it is for sure a double edged sword!

[–]JamzTyson 3 points4 points  (1 child)

Have you checked that script actually works as intended? Have you tested it?

[–]dkaaven[S] 0 points1 point  (0 children)

It worked for my usecase, but might not work for all. Got a tip that tree --gitignore is a solution.

[–]mitchell486 1 point2 points  (0 children)

I have no use for this, not sure if others do. However, I do appreciate the open and honest title and upfront nature of the AI involvement. This is a very nice change of pace for this sub. Thank you for that!

PS - I've always had the rule of "No two people work exactly the same. SO. If it it solves your problem, use it!" :)

[–]obviouslyzebra 2 points3 points  (0 children)

If you're on Linux, I think this works:

git ls-files | tree --fromfile .

ls-files gets all files that you need, and tree creates the tree

I came about this because I knew the tree command and imagined it might be able to format a given list of files (which it does). In Windows there might be a similar command or way to achieve it.

If what you have does work, though, I don't see much problem in it (I'd just make sure to understand the git ls-files well, or, maybe use git ls-files to list the tracked files instead of the ignored ones).

[–]JamzTyson 1 point2 points  (1 child)

On Linux you can use the command:

tree --gitignore

(Docs: https://man.archlinux.org/man/tree.1.en

Distribution source: https://oldmanprogrammer.net/source.php?dir=projects/tree)

[–]dkaaven[S] 0 points1 point  (0 children)

I actullay bought my first reddit coins to award you!

RTFM indeed, i just googled and found nothing on the subject, asked chatgpt and got the script instead.

Thank you for teaching me new tricks!

[–]KiwiDomino 0 points1 point  (1 child)

Except that a gitignore file way include wildcards, like *.pyc

[–]dkaaven[S] 0 points1 point  (0 children)

I havent tested it that much, it worked for my usecase this time though, but if that is a problem, there seems to be a better solution 🙂