UNPKG

claude-statusline-powerline

Version:

Beautiful powerline-style statusline for Claude Code with git integration, session tracking, and cost monitoring

100 lines 3.93 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); Object.defineProperty(exports, "__esModule", { value: true }); const child_process_1 = require("child_process"); const fs = __importStar(require("fs")); const path = __importStar(require("path")); const config_1 = require("./config"); function ensure_claude_directory() { const claude_dir = path.dirname((0, config_1.get_config_path)()); if (!fs.existsSync(claude_dir)) { fs.mkdirSync(claude_dir, { recursive: true }); console.log(`Created Claude directory: ${claude_dir}`); } } function create_default_config() { const config_path = (0, config_1.get_config_path)(); ensure_claude_directory(); fs.writeFileSync(config_path, JSON.stringify(config_1.DEFAULT_CONFIG_TEMPLATE, null, 2)); console.log(`Created default config at: ${config_path}`); } function open_config_in_editor() { const config_path = (0, config_1.get_config_path)(); // Create config if it doesn't exist if (!fs.existsSync(config_path)) { create_default_config(); } // Try to open in user's preferred editor const editor = process.env.EDITOR || process.env.VISUAL || 'code' || 'nano'; console.log(`Opening config in ${editor}: ${config_path}`); const child = (0, child_process_1.spawn)(editor, [config_path], { stdio: 'inherit', detached: true, }); child.on('error', (error) => { console.error(`Failed to open editor: ${error.message}`); console.log(`You can manually edit: ${config_path}`); }); } function show_config_info() { const config_path = (0, config_1.get_config_path)(); console.log('Claude Statusline Powerline Configuration'); console.log('====================================='); console.log(`Config location: ${config_path}`); console.log(`Exists: ${fs.existsSync(config_path) ? 'Yes' : 'No'}`); console.log(''); console.log('Commands:'); console.log(' claude-statusline --config Open config in editor'); console.log(' claude-statusline --config-create Create default config'); console.log(' claude-statusline --config-path Show config file path'); } // Parse command line arguments const args = process.argv.slice(2); if (args.includes('--config')) { open_config_in_editor(); } else if (args.includes('--config-create')) { create_default_config(); } else if (args.includes('--config-path')) { console.log((0, config_1.get_config_path)()); } else if (args.includes('--config-info')) { show_config_info(); } else { show_config_info(); } //# sourceMappingURL=cli-config.js.map