mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 13:32:50 -05:00
matugen: publish vscode theme to marketplace/ovsix
This commit is contained in:
@@ -309,11 +309,11 @@ output_path = '%s'
|
||||
|
||||
if !opts.ShouldSkipTemplate("vscode") {
|
||||
homeDir, _ := os.UserHomeDir()
|
||||
appendVSCodeConfig(cfgFile, "vscode", filepath.Join(homeDir, ".vscode/extensions/local.dynamic-base16-dankshell-0.0.1"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "codium", filepath.Join(homeDir, ".vscode-oss/extensions/local.dynamic-base16-dankshell-0.0.1"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "codeoss", filepath.Join(homeDir, ".config/Code - OSS/extensions/local.dynamic-base16-dankshell-0.0.1"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "cursor", filepath.Join(homeDir, ".cursor/extensions/local.dynamic-base16-dankshell-0.0.1"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "windsurf", filepath.Join(homeDir, ".windsurf/extensions/local.dynamic-base16-dankshell-0.0.1"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "vscode", filepath.Join(homeDir, ".vscode/extensions"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "codium", filepath.Join(homeDir, ".vscode-oss/extensions"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "codeoss", filepath.Join(homeDir, ".config/Code - OSS/extensions"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "cursor", filepath.Join(homeDir, ".cursor/extensions"), opts.ShellDir)
|
||||
appendVSCodeConfig(cfgFile, "windsurf", filepath.Join(homeDir, ".windsurf/extensions"), opts.ShellDir)
|
||||
}
|
||||
|
||||
if opts.RunUserTemplates {
|
||||
@@ -428,10 +428,14 @@ func appendTerminalConfig(opts *Options, cfgFile *os.File, tmpDir string, checkC
|
||||
cfgFile.WriteString("\n")
|
||||
}
|
||||
|
||||
func appendVSCodeConfig(cfgFile *os.File, name, extDir, shellDir string) {
|
||||
if _, err := os.Stat(extDir); err != nil {
|
||||
func appendVSCodeConfig(cfgFile *os.File, name, extBaseDir, shellDir string) {
|
||||
pattern := filepath.Join(extBaseDir, "danklinux.dms-theme-*")
|
||||
matches, err := filepath.Glob(pattern)
|
||||
if err != nil || len(matches) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
extDir := matches[0]
|
||||
templateDir := filepath.Join(shellDir, "matugen", "templates")
|
||||
fmt.Fprintf(cfgFile, `[templates.dms%sdefault]
|
||||
input_path = '%s/vscode-color-theme-default.json'
|
||||
|
||||
@@ -210,21 +210,43 @@ func TestFlatpakInstallationDirCommandFailure(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAnyFlatpakExistsSomeExist(t *testing.T) {
|
||||
if !FlatpakInPath() {
|
||||
t.Skip("flatpak not in PATH")
|
||||
tempDir := t.TempDir()
|
||||
fakeFlatpak := filepath.Join(tempDir, "flatpak")
|
||||
|
||||
// Script that succeeds only for "app.exists.test"
|
||||
script := `#!/bin/sh
|
||||
if [ "$1" = "info" ] && [ "$2" = "app.exists.test" ]; then
|
||||
exit 0
|
||||
fi
|
||||
exit 1
|
||||
`
|
||||
err := os.WriteFile(fakeFlatpak, []byte(script), 0755)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create fake flatpak: %v", err)
|
||||
}
|
||||
|
||||
result := AnyFlatpakExists("com.nonexistent.flatpak", "app.zen_browser.zen", "com.another.nonexistent")
|
||||
originalPath := os.Getenv("PATH")
|
||||
t.Setenv("PATH", tempDir+":"+originalPath)
|
||||
|
||||
result := AnyFlatpakExists("com.nonexistent.flatpak", "app.exists.test", "com.another.nonexistent")
|
||||
if !result {
|
||||
t.Errorf("expected true when at least one flatpak exists")
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnyFlatpakExistsNoneExist(t *testing.T) {
|
||||
if !FlatpakInPath() {
|
||||
t.Skip("flatpak not in PATH")
|
||||
tempDir := t.TempDir()
|
||||
fakeFlatpak := filepath.Join(tempDir, "flatpak")
|
||||
|
||||
script := "#!/bin/sh\nexit 1\n"
|
||||
err := os.WriteFile(fakeFlatpak, []byte(script), 0755)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create fake flatpak: %v", err)
|
||||
}
|
||||
|
||||
originalPath := os.Getenv("PATH")
|
||||
t.Setenv("PATH", tempDir+":"+originalPath)
|
||||
|
||||
result := AnyFlatpakExists("com.nonexistent.flatpak1", "com.nonexistent.flatpak2")
|
||||
if result {
|
||||
t.Errorf("expected false when no flatpaks exist")
|
||||
|
||||
Reference in New Issue
Block a user