Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add dotfiles command#1723

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
f0ssel merged 32 commits intomainfromf0ssel/dotfiles-cmd
May 25, 2022
Merged
Changes from1 commit
Commits
Show all changes
32 commits
Select commitHold shift + click to select a range
7235e3a
chore: propose coder dotfiles command
f0sselMay 23, 2022
6cd9f17
simplify example
f0sselMay 23, 2022
6a2bd87
add command skeleton
f0sselMay 24, 2022
3417628
Merge branch 'f0ssel/dotfiles-poc' of github.com:coder/coder into f0s…
f0sselMay 24, 2022
e127fe7
do clone/checkout
f0sselMay 24, 2022
17490a4
add install and symlinking
f0sselMay 24, 2022
2cf43d6
fix lint
f0sselMay 24, 2022
3302497
spruce
f0sselMay 24, 2022
250d10a
revert tf
f0sselMay 24, 2022
675f7e6
lint
f0sselMay 24, 2022
eae24d0
ignore git files
f0sselMay 24, 2022
8cf1c4f
pr comments
f0sselMay 24, 2022
42e9028
remove shorthand
f0sselMay 24, 2022
0b6480b
fixup
f0sselMay 24, 2022
2769e0a
Add tests
f0sselMay 24, 2022
051a361
lint
f0sselMay 24, 2022
23c950a
try removing parallel
f0sselMay 24, 2022
43c8b4f
formatting
f0sselMay 24, 2022
2197126
pr comments
f0sselMay 25, 2022
9e073ab
save dotfiles url config
f0sselMay 25, 2022
0467613
fixup
f0sselMay 25, 2022
3b505b0
%q
f0sselMay 25, 2022
fd9ba2a
testing
f0sselMay 25, 2022
624265f
testing
f0sselMay 25, 2022
44efa67
testing
f0sselMay 25, 2022
b059fdf
organize:
f0sselMay 25, 2022
b265149
add symlink backup test
f0sselMay 25, 2022
581d6b8
handle script for windows
f0sselMay 25, 2022
6dfc469
switch to require
f0sselMay 25, 2022
df5f6cd
pr comments
f0sselMay 25, 2022
b29ddf4
skip install script test on windows
f0sselMay 25, 2022
a435224
fix command
f0sselMay 25, 2022
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
PrevPrevious commit
NextNext commit
add symlink backup test
  • Loading branch information
@f0ssel
f0ssel committedMay 25, 2022
commitb265149ff849c716bc1f14fb14b79f8aa91bcaef
36 changes: 36 additions & 0 deletionscli/dotfiles_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -73,6 +73,42 @@ func TestDotfiles(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, string(b), "wow\n")
})
t.Run("SymlinkBackup", func(t *testing.T) {
_, root := clitest.New(t)
testRepo := testGitRepo(t, root)

// nolint:gosec
err := os.WriteFile(filepath.Join(testRepo, ".bashrc"), []byte("wow"), 0750)
assert.NoError(t, err)

// add a conflicting file at destination
// nolint:gosec
err = os.WriteFile(filepath.Join(string(root), ".bashrc"), []byte("backup"), 0750)
assert.NoError(t, err)

c := exec.Command("git", "add", ".bashrc")
c.Dir = testRepo
err = c.Run()
assert.NoError(t, err)

c = exec.Command("git", "commit", "-m", `"add .bashrc"`)
c.Dir = testRepo
out, err := c.CombinedOutput()
assert.NoError(t, err, string(out))

cmd, _ := clitest.New(t, "dotfiles", "--global-config", string(root), "--symlink-dir", string(root), "-y", testRepo)
err = cmd.Execute()
assert.NoError(t, err)

b, err := os.ReadFile(filepath.Join(string(root), ".bashrc"))
assert.NoError(t, err)
assert.Equal(t, string(b), "wow")

// check for backup file
b, err = os.ReadFile(filepath.Join(string(root), ".bashrc.bak"))
assert.NoError(t, err)
assert.Equal(t, string(b), "backup")
})
}

func testGitRepo(t *testing.T, root config.Root) string {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp