141 lines · 6.1 KB · Swift
RawDownload
import CodexBarCoreimport Foundation extension CodexBarCLI {    static func usageHelp(version: String) -> String {        """        CodexBar \(version)         Usage:          codexbar usage [--format text|json]                       [--json]                       [--json-only]                       [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>] [-v|--verbose]                       [--provider \(ProviderHelp.list)]                       [--account <label>] [--account-index <index>] [--all-accounts]                       [--no-credits] [--no-color] [--pretty] [--status] [--source <auto|web|cli|oauth|api>]                       [--web-timeout <seconds>] [--web-debug-dump-html] [--antigravity-plan-debug] [--augment-debug]         Description:          Print usage from enabled providers as text (default) or JSON. Honors your in-app toggles.          Output format: use --json (or --format json) for JSON on stdout; use --json-output for JSON logs on stderr.          When --source is auto/web (macOS only), CodexBar uses browser cookies to fetch web-backed data:          - Codex: OpenAI web dashboard (usage limits, credits remaining, code review remaining, usage breakdown).            Auto falls back to Codex CLI only when cookies are missing.          - Claude: claude.ai API.            Auto falls back to Claude CLI only when cookies are missing.          Token accounts are loaded from ~/.codexbar/config.json.          Use --account or --account-index to select a specific token account, or --all-accounts to fetch all.          Account selection requires a single provider.         Global flags:          -h, --help      Show help          -V, --version   Show version          -v, --verbose   Enable verbose logging          --no-color      Disable ANSI colors in text output          --log-level <trace|verbose|debug|info|warning|error|critical>          --json-output   Emit machine-readable logs (JSONL) to stderr         Examples:          codexbar usage          codexbar usage --provider claude          codexbar usage --provider gemini          codexbar usage --format json --provider all --pretty          codexbar usage --provider all --json          codexbar usage --status          codexbar usage --provider codex --source web --format json --pretty        """    }     static func costHelp(version: String) -> String {        """        CodexBar \(version)         Usage:          codexbar cost [--format text|json]                       [--json]                       [--json-only]                       [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>] [-v|--verbose]                       [--provider \(ProviderHelp.list)]                       [--no-color] [--pretty] [--refresh]         Description:          Print local token cost usage from Claude/Codex JSONL logs. This does not require web or CLI access.          Uses cached scan results unless --refresh is provided.         Examples:          codexbar cost          codexbar cost --provider claude --format json --pretty        """    }     static func configHelp(version: String) -> String {        """        CodexBar \(version)         Usage:          codexbar config validate [--format text|json]                                 [--json]                                 [--json-only]                                 [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>]                                 [-v|--verbose]                                 [--pretty]          codexbar config dump [--format text|json]                             [--json]                             [--json-only]                             [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>]                             [-v|--verbose]                             [--pretty]         Description:          Validate or print the CodexBar config file (default: validate).         Examples:          codexbar config validate --format json --pretty          codexbar config dump --pretty        """    }     static func rootHelp(version: String) -> String {        """        CodexBar \(version)         Usage:          codexbar [--format text|json]                  [--json]                  [--json-only]                  [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>] [-v|--verbose]                  [--provider \(ProviderHelp.list)]                  [--account <label>] [--account-index <index>] [--all-accounts]                  [--no-credits] [--no-color] [--pretty] [--status] [--source <auto|web|cli|oauth|api>]                  [--web-timeout <seconds>] [--web-debug-dump-html] [--antigravity-plan-debug] [--augment-debug]          codexbar cost [--format text|json]                       [--json]                       [--json-only]                       [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>] [-v|--verbose]                       [--provider \(ProviderHelp.list)] [--no-color] [--pretty] [--refresh]          codexbar config <validate|dump> [--format text|json]                                        [--json]                                        [--json-only]                                        [--json-output] [--log-level <trace|verbose|debug|info|warning|error|critical>]                                        [-v|--verbose]                                        [--pretty]         Global flags:          -h, --help      Show help          -V, --version   Show version          -v, --verbose   Enable verbose logging          --no-color      Disable ANSI colors in text output          --log-level <trace|verbose|debug|info|warning|error|critical>          --json-output   Emit machine-readable logs (JSONL) to stderr         Examples:          codexbar          codexbar --format json --provider all --pretty          codexbar --provider all --json          codexbar --provider gemini          codexbar cost --provider claude --format json --pretty          codexbar config validate --format json --pretty        """    }}