EasyAgent/demo/lib/env.js
2026-02-28 03:00:08 +08:00

24 lines
515 B
JavaScript

'use strict';
const os = require('os');
const path = require('path');
const WORKSPACE = process.cwd();
const WORKSPACE_NAME = path.basename(WORKSPACE) || WORKSPACE;
const USERNAME = os.userInfo().username || 'user';
const PROMPT = `${USERNAME}@${WORKSPACE_NAME} `;
const COLOR_ENABLED = !process.env.NO_COLOR;
const GREY = COLOR_ENABLED ? '\x1b[90m' : '';
const RESET = COLOR_ENABLED ? '\x1b[0m' : '';
module.exports = {
WORKSPACE,
WORKSPACE_NAME,
USERNAME,
PROMPT,
COLOR_ENABLED,
GREY,
RESET,
};