Overview
TinyPM's modular architecture makes it straightforward to add new backends. This guide walks through creating a custom provider for your package manager of choice.
Step 1: Create the Provider File
Create a new file in lib/providers/:
touch lib/providers/mybackend.shStep 2: Implement the Interface
Your provider script should define functions for each supported action:
# lib/providers/mybackend.sh
provider_install() {
local package="$1"
# Your install logic here
mypm install "$package"
}
provider_search() {
local query="$1"
# Your search logic here
mypm search "$query"
}
provider_remove() {
local package="$1"
# Your remove logic here
mypm remove "$package"
}
provider_list() {
# Your list logic here
mypm list --installed
}
provider_update() {
# Your update logic here
mypm upgrade
}
provider_run() {
local app="$1"
# Your run logic here
mypm run "$app"
}
provider_check() {
# Return 0 if backend is available, 1 if not
command -v mypm > /dev/null 2>&1
}Step 3: Register the Backend
Add your backend to the core's provider loading logic so it can be selected with a flag.
Step 4: Add a Flag
Register a short flag (e.g. -m) and long flags (e.g. --mypm) in the argument parser.
Step 5: Test
tinypm doctor # Should show your backend
tinypm search -m test
tinypm install -m mypackageTips
- Follow the existing provider patterns for consistency
- Use
provider_check()sodoctorcan report on your backend - Keep the provider focused on wrapping the real CLI
- Test with
doctorfirst to make sure detection works
Contributing
If you build a provider that could be useful to others, consider contributing it back to the [TinyPM repository](https://github.com/AnimatedGTVR/TinyPM).