Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions repos.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (r *Repository) APTConfigLine() string {

var aptConfigLineRegexp = regexp.MustCompile(`^(# )?(deb|deb-src)(?: \[(.*)\])? ([^ ]+) ([^ ]+) ([^#\n]+)(?: +# *(.*))?$`)

func parseAPTConfigLine(line string) *Repository {
func ParseAPTConfigLine(line string) *Repository {
match := aptConfigLineRegexp.FindAllStringSubmatch(line, -1)
if len(match) == 0 || len(match[0]) < 6 {
return nil
Expand All @@ -134,7 +134,7 @@ func parseAPTConfigFile(configPath string) (RepositoryList, error) {
res := RepositoryList{}
for scanner.Scan() {
line := scanner.Text()
repo := parseAPTConfigLine(line)
repo := ParseAPTConfigLine(line)
if repo != nil {
repo.configFile = configPath
res = append(res, repo)
Expand Down Expand Up @@ -226,7 +226,7 @@ func RemoveRepository(repo *Repository, configFolderPath string) error {
newContent := ""
for scanner.Scan() {
line := scanner.Text()
r := parseAPTConfigLine(line)
r := ParseAPTConfigLine(line)
if r != nil && r.Equals(repo) {
// Filter repo configs that match the repo to be removed
continue
Expand Down Expand Up @@ -269,7 +269,7 @@ func EditRepository(old *Repository, newRepo *Repository, configFolderPath strin
newContent := ""
for scanner.Scan() {
line := scanner.Text()
r := parseAPTConfigLine(line)
r := ParseAPTConfigLine(line)
if r.Equals(old) {
// Write the new config to replace the old one
newContent += newRepo.APTConfigLine() + "\n"
Expand Down