Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c7d0cb4
Added gRPC functions to manage libraries in profiles
cmaglie Oct 3, 2025
92cf64f
Removed ProfileDump gRPC command.
cmaglie Oct 6, 2025
ed5d6a2
Moved SketchProfileLibraryReference in the proper commono.proto file
cmaglie Oct 6, 2025
c74f073
linter: removed unneeded type specification
cmaglie Oct 6, 2025
34c378c
Renamed SketchProfileLibraryReference -> ProfileLibraryReference
cmaglie Oct 22, 2025
0c78b3f
Renamed InitProfile -> ProfileCreate
cmaglie Oct 22, 2025
3c5a3c9
Small refactoring, no code change
cmaglie Oct 23, 2025
4d78f7f
Fixed error messages
cmaglie Oct 23, 2025
d4cbad2
Removed unnecessary type specifier
cmaglie Oct 24, 2025
140c069
Refactored libraryResolveDependencies.
cmaglie Oct 27, 2025
5ac03d8
Added support for 'dependency:' field in profiles libraries
cmaglie Oct 29, 2025
e17724b
ProfileLibAdd and ProfileLibRemove can now cleanup unneeded dependencies
cmaglie Oct 29, 2025
4bb86e7
Better error messages
cmaglie Nov 21, 2025
f520cb9
Simplified Profile.RemoveLibrary(...) method.
cmaglie Nov 21, 2025
4e80e73
Fixed algorithm for determination of required deps
cmaglie Nov 21, 2025
dbafbe6
Updated docs
cmaglie Nov 25, 2025
4f527c0
Rename DuplicateProfileError -> ProfileAlreadyExitsError
cmaglie Nov 26, 2025
1909ab7
Removed useless field in gRPC ProfileCreateResponse
cmaglie Nov 26, 2025
8b4b3a5
fix: ProfileCreate sets the new profile as default only if asked to d…
cmaglie Nov 26, 2025
ad5d941
Improved docs
cmaglie Dec 1, 2025
3a14601
Applied code review suggestion
cmaglie Dec 1, 2025
2aa7e32
Using cmp.Or helper
cmaglie Dec 1, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Simplified Profile.RemoveLibrary(...) method.
  • Loading branch information
cmaglie committed Nov 25, 2025
commit f520cb96c3375d3eae1cf26d5c940d4735b6250c
14 changes: 8 additions & 6 deletions internal/arduino/sketch/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,16 @@ func (p *Profile) GetLibrary(libraryName string) (*ProfileLibraryReference, erro
return nil, &cmderrors.LibraryNotFoundError{Library: libraryName}
}

// RemoveLibrary removes a library from this profile and returns the removed ProfileLibraryReference.
// If the library is not found, an error is returned.
func (p *Profile) RemoveLibrary(library *ProfileLibraryReference) (*ProfileLibraryReference, error) {
for i, l := range p.Libraries {
if l.Match(library) {
p.Libraries = slices.Delete(p.Libraries, i, i+1)
return l, nil
}
i := slices.IndexFunc(p.Libraries, library.Match)
if i == -1 {
return nil, &cmderrors.LibraryNotFoundError{Library: library.String()}
}
return nil, &cmderrors.LibraryNotFoundError{Library: library.String()}
removedLib := p.Libraries[i]
p.Libraries = slices.Delete(p.Libraries, i, i+1)
return removedLib, nil
}

// ToRpc converts this Profile to an rpc.SketchProfile
Expand Down