This commit is contained in:
thatben 2025-02-14 11:56:16 +01:00
parent 2114d737cb
commit 9a1ce2bf52
No known key found for this signature in database
GPG Key ID: 62C543548433D43E
2 changed files with 34 additions and 0 deletions

View File

@ -9,6 +9,7 @@ import { uploadFile, downloadFile, showLocalFiles } from './handlers/fileHandler
import { checkCodexInstallation, installCodex, uninstallCodex } from './handlers/installationHandlers.js';
import { runCodex, checkNodeStatus } from './handlers/nodeHandlers.js';
import { showInfoMessage } from './utils/messages.js';
import { getAppDataDir } from "./utils/appdata.js";
async function showNavigationMenu() {
console.log('\n')
@ -49,6 +50,10 @@ function handleExit() {
process.exit(0);
}
function getWorkingDir(commandArgs) {
}
export async function main() {
const commandArgs = parseCommandLineArgs();
if (commandArgs) {
@ -69,6 +74,7 @@ export async function main() {
try {
while (true) {
console.log('\n' + chalk.cyanBright(ASCII_ART));
console.log(showInfoMessage(`Working directory: ${getAppDataDir()}`));
const { choice } = await inquirer.prompt([
{

28
src/utils/appdata.js Normal file
View File

@ -0,0 +1,28 @@
import path from 'path';
export function getAppDataDir() {
return appData("codex-cli");
}
function appData(...app) {
let appData;
if (process.platform === 'win32') {
appData = path.join(process.env.APPDATA, ...app);
} else if (process.platform === 'darwin') {
appData = path.join(process.env.HOME, 'Library', 'Application Support', ...app);
} else {
appData = path.join(process.env.HOME, ...prependDot(...app));
}
return appData;
}
function prependDot(...app) {
return app.map((item, i) => {
if (i === 0) {
return `.${item}`;
} else {
return item;
}
});
}