Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ coda api /whoami
coda wait <request-id>
```

### Experimental local search

```sh
coda experimental index
coda experimental index --force --json
coda experimental grep "quarterly plan"
coda experimental grep "status.*blocked" --ignore-case
```

The experimental index is stored under your Coda CLI config directory, for example
`~/.config/coda-cli/experimental/workspace-index` unless `CODA_CONFIG_DIR` is set.

---

## Configuration
Expand Down
18 changes: 13 additions & 5 deletions internal/auth/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,37 @@ type AuthConfig struct {
APIToken string `yaml:"api_token"`
}

func ConfigPath() (string, error) {
func ConfigDir() (string, error) {
if dir := os.Getenv(configDirEnvVar); dir != "" {
return filepath.Join(dir, "config.yaml"), nil
return dir, nil
}

if xdgDir := os.Getenv("XDG_CONFIG_HOME"); xdgDir != "" {
return filepath.Join(xdgDir, "coda-cli", "config.yaml"), nil
return filepath.Join(xdgDir, "coda-cli"), nil
}

if runtime.GOOS == "windows" {
configDir, err := os.UserConfigDir()
if err != nil {
return "", fmt.Errorf("failed to resolve user config dir: %w", err)
}
return filepath.Join(configDir, "coda-cli", "config.yaml"), nil
return filepath.Join(configDir, "coda-cli"), nil
}

homeDir, err := os.UserHomeDir()
if err != nil {
return "", fmt.Errorf("failed to resolve home dir: %w", err)
}

return filepath.Join(homeDir, ".config", "coda-cli", "config.yaml"), nil
return filepath.Join(homeDir, ".config", "coda-cli"), nil
}

func ConfigPath() (string, error) {
dir, err := ConfigDir()
if err != nil {
return "", err
}
return filepath.Join(dir, "config.yaml"), nil
}

func LoadAuthConfig() (*AuthConfig, error) {
Expand Down
Loading
Loading