8000 feat: custom rc path (#41) · antfu-collective/ni@35960e4 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 35960e4

Browse files
authored
feat: custom rc path (#41)
1 parent 723fe02 commit 35960e4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,13 @@ nr -C playground dev
176176

177177
### Config
178178

179+
```bash
180+
# ~/.bashrc
181+
182+
# custom configuration file path
183+
export NI_CONFIG_FILE="$HOME/.config/ni/nirc"
184+
```
185+
179186
```ini
180187
; ~/.nirc
181188

src/config.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import path from 'path'
33
import ini from 'ini'
44
import { Agent } from './agents'
55

6+
const customRcPath = process.env.NI_CONFIG_FILE
7+
68
const home = process.platform === 'win32'
79
? process.env.USERPROFILE
810
: process.env.HOME
911

10-
const rcPath = path.join(home || '~/', '.nirc')
12+
const defaultRcPath = path.join(home || '~/', '.nirc')
13+
14+
const rcPath = customRcPath || defaultRcPath
1115

1216
interface Config {
1317
defaultAgent: Agent | 'prompt'

0 commit comments

Comments
 (0)
0