Skip to content

Commit 963f676

Browse files
committed
Add a ListInstalled function
I've needed at times to list the packages that are currently listed on a system. Search("") is equivalent to that, but since we have List() which is equivalent to Search("*"), I figured this might be handy to have as well.
1 parent 0d7233b commit 963f676

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

apt.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ func List() ([]*Package, error) {
4444
return Search("*")
4545
}
4646

47+
// ListInstalled returns a list of packages installed on the system.
48+
func ListInstalled() ([]*Package, error) {
49+
return Search("")
50+
}
51+
4752
// Search list packages available in the system that match the search
4853
// pattern
4954
func Search(pattern string) ([]*Package, error) {

0 commit comments

Comments
 (0)