Thank you for your interest in contributing! This document provides guidelines for contributing to the utilities repository.
Be respectful, constructive, and professional in all interactions.
- Check if the issue already exists in GitHub Issues
- Include the following in your report:
- OS and version (macOS version, Linux distribution)
- Bash version (
bash --version) - Steps to reproduce
- Expected vs actual behavior
- Relevant error messages or logs
- Open a GitHub Issue with the
enhancementlabel - Clearly describe the feature and its use case
- Explain why this enhancement would be useful
- Consider backwards compatibility
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature-name) - Make your changes following our coding standards
- Test your changes thoroughly
- Update documentation as needed
- Commit with clear, descriptive messages
- Push to your fork
- Open a Pull Request
- Use bash 3.2 compatible syntax (macOS default)
- Indent with tabs (as used in existing code)
- Use descriptive variable names
- Add comments for complex logic
# Good: Use local variables in functions
function_name() {
local variable_name="value"
# ...
}
# Good: Check command existence before use
if cmd_exists "tool"; then
# Use tool
fi
# Good: Provide user feedback
action "Performing operation"
execute "command" "User-friendly message"
success "Operation complete"
# Good: Handle errors
if ! command; then
error "Command failed"
return 1
fi- Use descriptive names:
install_package()notinst() - Follow existing patterns:
is_tool_installed(),tool_install() - Use snake_case for function names
- Always check return codes for critical operations
- Provide meaningful error messages
- Use the base module's output functions (error, warn, etc.)
Every new function must be documented in its module's README:
### `function_name(param1 [param2])`
Brief description of what the function does.
**Parameters:**
- `$1` - Description of first parameter
- `$2` - Optional: Description of optional parameter
**Returns:** Description of return value/code
**Usage:**
\`\`\`bash
# Example usage
function_name "value1"
\`\`\`When adding functions:
- Add to module's README.md
- Add to FUNCTIONS.md index
- Update CHANGELOG.md
All scripts must pass shellcheck:
./tests/main.shTest your changes on:
- macOS (if applicable)
- Ubuntu/Debian (if applicable)
- bash 3.2 (macOS default)
- bash 4.0+ (modern Linux)
Consider:
- Does it work when the tool is not installed?
- Does it work when the tool is already installed?
- Does it handle errors gracefully?
- Does it work in non-interactive mode?
We follow Semantic Versioning:
- MAJOR: Incompatible API changes
- MINOR: New functionality (backwards compatible)
- PATCH: Bug fixes (backwards compatible)
-
Update Version
- Update
UTILITIES_VERSIONinutilities.sh - Update version in
README.md
- Update
-
Update CHANGELOG.md
- Move items from [Unreleased] to new version section
- Add release date
- Include all changes since last release
-
Test
- Run shellcheck tests:
./tests/main.sh - Manual testing on macOS and Linux
- Test version pinning with new tag
- Run shellcheck tests:
-
Create Release
git tag -a v1.x.x -m "Release v1.x.x" git push origin v1.x.x -
GitHub Release
- Create release on GitHub
- Use CHANGELOG content for release notes
- Attach any relevant assets
When adding a new module:
scripts/modules/tool-name/
├── README.md # Module documentation
├── tool.sh # Main module script
└── helper.sh # Optional helper scripts
#!/bin/bash
# shellcheck source=/dev/null
source /dev/stdin <<<"$(curl -s "https://raw.githubusercontent.com/dotbrains/utilities/master/scripts/base/base.sh")"
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# tool-name functions
is_tool_installed() {
if ! cmd_exists "tool"; then
return 1
fi
}
tool_install() {
local package="$1"
# Check if tool is installed
is_tool_installed || return 1
# Perform operation
# ...
}- Open an issue for questions
- Check existing documentation
- Review similar modules for patterns
By contributing, you agree that your contributions will be licensed under the same license as the project.
Thank you for contributing to make this project better!