Skip to content

Commit 9e073ab

Browse files
committed
save dotfiles url config
1 parent 2197126 commit 9e073ab

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cli/dotfiles.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,12 @@ func dotfiles() *cobra.Command {
133133
_, _ = fmt.Fprintln(cmd.OutOrStdout(), cliui.Styles.Error.Render("Failed to update repo, continuing..."))
134134
}
135135

136+
// save git repo url so we can detect changes next time
137+
err = cfg.DotfilesURL().Write(gitRepo)
138+
if err != nil {
139+
return xerrors.Errorf("writing dotfiles url config: %w", err)
140+
}
141+
136142
files, err := os.ReadDir(dotfilesDir)
137143
if err != nil {
138144
return xerrors.Errorf("reading files in dir %s: %w", dotfilesDir, err)
@@ -228,7 +234,7 @@ func dotfiles() *cobra.Command {
228234
return cmd
229235
}
230236

231-
// dirExists checks if the dir already exists.
237+
// dirExists checks if the path exists and is a directory.
232238
func dirExists(name string) (bool, error) {
233239
fi, err := os.Stat(name)
234240
if err != nil {
@@ -258,6 +264,7 @@ func findScript(scriptSet []string, files []fs.DirEntry) string {
258264
return ""
259265
}
260266

267+
// isRegular detects if the file exists and is not a symlink.
261268
func isRegular(to string) (bool, error) {
262269
fi, err := os.Lstat(to)
263270
if err != nil {

0 commit comments

Comments
 (0)