Download src/utils/opencode-database-path.js from VanyaJ/bada-terminal: direct link, hf CLI and curl.
- Browser
- Download file 962 Bytes
-
https://huggingface.co/VanyaJ/bada-terminal/resolve/main/src/utils/opencode-database-path.js
- Command line
-
hf download hf://VanyaJ/bada-terminal/src/utils/opencode-database-path.js
-
curl -L -o opencode-database-path.js https://huggingface.co/VanyaJ/bada-terminal/resolve/main/src/utils/opencode-database-path.js
962 Bytes
| // ์ค๋ช ๋ฌธ์: docs/specs/cli-runtime-initialization.md (v1.1.0) | |
| const path = require('path'); | |
| function environmentValue(env, name) { | |
| return env[name] ?? (process.platform === 'win32' ? env[Object.keys(env).find(key => key.toUpperCase() === name)] : undefined); | |
| } | |
| function selectedDatabase(dataDirectory, setting) { | |
| if (!setting) return { kind: 'default', file: path.join(dataDirectory, 'opencode.db') }; | |
| if (setting === ':memory:') return { kind: 'memory', file: null }; | |
| if (typeof setting !== 'string' || setting.includes('\0')) throw new Error('Invalid OpenCode database path'); | |
| // CLI์ ๋์ผํ๊ฒ ์๋ ๊ฒฝ๋ก๋ cwd๊ฐ ์๋ OpenCode ๋ฐ์ดํฐ ๋๋ ํฐ๋ฆฌ์์ ํด์ํ๋ค. | |
| const file = path.resolve(dataDirectory, setting); | |
| if (file === path.parse(file).root) throw new Error('OpenCode database must be a file, not a filesystem root'); | |
| return { kind: 'custom', file }; | |
| } | |
| module.exports = { environmentValue, selectedDatabase }; | |