Add custom path support for cli/tui in terminal config
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Global XO CLI config layout (XDG-style: ~/.config/xo-cli/).
|
||||
* Global XO CLI config layout (`XO_CONFIG_DIR` or ~/.config/xo-cli/).
|
||||
* User-provided paths (templates, invitation JSON) stay relative to cwd.
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,7 @@ import { basename, isAbsolute, join, resolve } from "node:path";
|
||||
* Base config directory. Created on first access.
|
||||
*/
|
||||
export function getConfigDir(): string {
|
||||
const dir = join(homedir(), ".config", "xo-cli");
|
||||
const dir = process.env["XO_CONFIG_DIR"] || join(homedir(), ".config", "xo-cli");
|
||||
mkdirSync(dir, { recursive: true });
|
||||
return dir;
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export function getWalletConfigPath(): string {
|
||||
|
||||
/**
|
||||
* Resolves a mnemonic reference to an absolute path.
|
||||
* Order: absolute path if it exists → path relative to cwd → ~/.config/xo-cli/mnemonics/<basename>.
|
||||
* Order: absolute path if it exists → path relative to cwd → config mnemonics directory/<basename>.
|
||||
*
|
||||
* @param mnemonicRef - Path or basename (e.g. `mnemonic-nuclear`)
|
||||
* @returns Absolute path to the mnemonic file
|
||||
|
||||
Reference in New Issue
Block a user