Skip to content

Commit

Permalink
feat: Read personal mackup config files
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Jul 31, 2023
1 parent 0b0fa89 commit 31787ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions internal/cmd/mackupcmd_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ package cmd
import (
"bufio"
"bytes"
"errors"
"fmt"
"os"
"os/exec"
"regexp"
"strings"
Expand Down Expand Up @@ -70,11 +72,14 @@ func (c *Config) runMackupAddCmd(
return err
}

mackupDirAbsPath := c.homeDirAbsPath.JoinString(".mackup")
var addArgs []string
for _, arg := range args {
data, err := c.baseSystem.ReadFile(
mackupApplicationsDir.Join(chezmoi.NewRelPath(arg + ".cfg")),
)
configRelPath := chezmoi.NewRelPath(arg + ".cfg")
data, err := c.baseSystem.ReadFile(mackupDirAbsPath.Join(configRelPath))
if errors.Is(err, os.ErrNotExist) {
data, err = c.baseSystem.ReadFile(mackupApplicationsDir.Join(configRelPath))
}
if err != nil {
return err
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ esac
# contents of .config/Code/User/settings.json
-- home/user/.curlrc --
# contents of .curlrc
-- opt/homebrew/Cellar/mackup/0.8.32/libexec/lib/python3.9/site-packages/mackup/applications/curl.cfg --
-- home/user/.mackup/curl.cfg --
[application]
name = Curl

Expand Down

0 comments on commit 31787ed

Please sign in to comment.