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

Support operation on a sub-tree of stages #168

Open
kevin-hanselman opened this issue Sep 7, 2023 · 0 comments
Open

Support operation on a sub-tree of stages #168

kevin-hanselman opened this issue Sep 7, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@kevin-hanselman
Copy link
Owner

kevin-hanselman commented Sep 7, 2023

Currently, the primary commands of Dud follow the convention that no inputs (e.g., dud commit alone) means operate on all stages. This feature would add support for operating on all stages within and below the current working directory. For example:

project-root/ $ dud status
# shows status for all stages

project-root/ $ cd subdir
project-root/subdir $ dud status
# shows status for all stages starting with subdir/

project-root/subdir $ dud status --all
# shows status for all stages (the current default behavior)

project-root/subdir $ dud status ../other-subdir/foo.yaml
# shows status for other-subdir/foo.yaml
# i.e., no change in current behavior when stages are explicitly specified

This would make working on projects with many distinct groupings of stages a bit easier. Organizing stages using the filesystem (rather than a monolithic file) is an intentional design choice in Dud, and this would be a sensible quality-of-life improvement for said design.

Alternatively, we could make a --tree option or similar that enables this behavior explicitly. I generally lean towards explicit over implicit, so this may be a better approach. Making this option explicit would also match Git, which has no such scope-limiting option that I'm aware of (unless you count submodules), thus reducing surprising behavior.

To accomplish this sub-tree behavior today, you'd have to manually pass each stage in a sub-tree to Dud. None of them are particularly clear, nor simple (these are pseudocode):

# depends on your shell's globbing behavior
# will break if there's other YAML files in the tree
project-root/subdir $ dud status **.yaml

# this grep command won't quite work; you need to strip the absolute paths
project-root/subdir $ grep -F "$(pwd)" ../../.dud/index | xargs dud status
@kevin-hanselman kevin-hanselman added the enhancement New feature or request label Sep 7, 2023
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