Last active
February 20, 2025 14:47
-
-
Save vinhloc30796/b5eba1d37f0c87bd96b17ba5de793dd7 to your computer and use it in GitHub Desktop.
A Justfile that sets the foundation for my others
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# List all commands | |
default: | |
just --list | |
# Add the directory tree to .notes/directory_structure.md, prefixed by datetime, dynamically accounting for whatever's in .gitignore | |
[group('notes')] | |
tree directory=".": | |
#!/usr/bin/env bash | |
# Add timestamp header | |
echo "Generated on $(date '+%Y-%m-%d %H:%M:%S')" > .notes/directory_structure.tree | |
git ls-files {{directory}} | tree --fromfile >> .notes/directory_structure.tree | |
echo "Exported to .notes/directory_structure.tree" | |
# Generate git diff logs - either for staged changes or against main branch | |
[group('git')] | |
diff choice="staged": | |
#!/usr/bin/env bash | |
if [ "{{choice}}" = "staged" ]; then | |
git diff --staged --output=diff-staged.diff | |
echo "Diff logged to diff-staged.diff" | |
elif [ "{{choice}}" = "main" ]; then | |
git diff main..HEAD --output=diff-main.diff | |
echo "Diff logged to diff-main.diff" | |
else | |
echo "Invalid choice. Use 'staged' or 'main'." | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment