tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.69k stars 303 forks source link

Listing directories #5268

Open remram44 opened 2 years ago

remram44 commented 2 years ago

Describe the Feature You Want

It should be possible to list subdirectories.

Current Behavior

listdir() lists files only, not directories.

Why Do You Want This?

I am building the live_update config for my app. Some directories are ok to live-reload (so I use sync()), and I want all others to go into fall_back_on().

Additional context There should probably be a way to tell whether a path is a file or a directory (like Python's isfile() and isdir()).

I managed to hack together a list of (non-empty) subdirectories from the recursive list of files: gist. This works but is a huge hack (and the / handling is probably not portable)

nicks commented 2 years ago

ya - listdir was added very early on and has a bunch of semantics that made sense at the time, but are very different from python's os.listdir. I wonder if we should simply deprecate it and add a new os.listdir that matches the python semantics.

related issue: https://github.com/tilt-dev/tilt/issues/3806