Skip to content

Commit 0467613

Browse files
committed
fixup
1 parent 9e073ab commit 0467613

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

cli/dotfiles.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ func dotfiles() *cobra.Command {
5656
moved := false
5757
if dotfilesExists {
5858
du, err := cfg.DotfilesURL().Read()
59-
if err != nil {
59+
if err != nil && !errors.Is(err, os.ErrNotExist) {
6060
return xerrors.Errorf("reading dotfiles url config: %w", err)
6161
}
6262
// if the git url has changed we create a backup and clone fresh
6363
if gitRepo != du {
6464
backupDir := fmt.Sprintf("%s_backup_%s", dotfilesDir, time.Now().Format(time.RFC3339))
6565
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
66-
Text: fmt.Sprintf("The dotfiles URL has changed from %s to %s. Coder will backup the existing repo to %s.\n\n Continue?", du, gitRepo, backupDir),
66+
Text: fmt.Sprintf("The dotfiles URL has changed from \"%s\" to \"%s\".\n Coder will backup the existing repo to %s.\n\n Continue?", du, gitRepo, backupDir),
6767
IsConfirm: true,
6868
})
6969
if err != nil {
@@ -74,6 +74,7 @@ func dotfiles() *cobra.Command {
7474
if err != nil {
7575
return xerrors.Errorf("renaming dir %s: %w", dotfilesDir, err)
7676
}
77+
_, _ = fmt.Fprint(cmd.OutOrStdout(), "Done backup up dotfiles.\n")
7778
dotfilesExists = false
7879
moved = true
7980
}
@@ -95,7 +96,7 @@ func dotfiles() *cobra.Command {
9596
}
9697
gitCmdDir = cfgDir
9798
subcommands = []string{"clone", args[0], dotfilesRepoDir}
98-
promptText = fmt.Sprintf("Cloning %s into directory %s.\n Continue?", gitRepo, dotfilesDir)
99+
promptText = fmt.Sprintf("Cloning %s into directory %s.\n\n Continue?", gitRepo, dotfilesDir)
99100
}
100101

101102
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
@@ -106,7 +107,7 @@ func dotfiles() *cobra.Command {
106107
return err
107108
}
108109

109-
// ensure config dir exists
110+
// ensure command dir exists
110111
err = os.MkdirAll(gitCmdDir, 0750)
111112
if err != nil {
112113
return xerrors.Errorf("ensuring dir at %s: %w", gitCmdDir, err)

0 commit comments

Comments
 (0)