|
1 | 1 | import { Command } from 'commander'; |
2 | | -import { parseEnvironmentVariables, parseDomains, parseDomainsFile, escapeShellArg, joinShellArgs, parseVolumeMounts, isValidIPv4, isValidIPv6, parseDnsServers, validateAgentImage, isAgentImagePreset, AGENT_IMAGE_PRESETS, processAgentImageOption, processLocalhostKeyword, validateSkipPullWithBuildLocal, validateAllowHostPorts, validateFormat, validateApiProxyConfig, buildRateLimitConfig, validateRateLimitFlags } from './cli'; |
| 2 | +import { parseEnvironmentVariables, parseDomains, parseDomainsFile, escapeShellArg, joinShellArgs, parseVolumeMounts, isValidIPv4, isValidIPv6, parseDnsServers, validateAgentImage, isAgentImagePreset, AGENT_IMAGE_PRESETS, processAgentImageOption, processLocalhostKeyword, validateSkipPullWithBuildLocal, validateAllowHostPorts, validateFormat, validateApiProxyConfig, buildRateLimitConfig, validateRateLimitFlags, formatItem } from './cli'; |
3 | 3 | import { redactSecrets } from './redact-secrets'; |
4 | 4 | import * as fs from 'fs'; |
5 | 5 | import * as path from 'path'; |
@@ -1539,4 +1539,23 @@ describe('cli', () => { |
1539 | 1539 | expect(result.error).toBeUndefined(); |
1540 | 1540 | }); |
1541 | 1541 | }); |
| 1542 | + |
| 1543 | + describe('formatItem', () => { |
| 1544 | + it('should format item with description on same line when term fits', () => { |
| 1545 | + const result = formatItem('-v', 'verbose output', 20, 2, 2, 80); |
| 1546 | + expect(result).toBe(' -v verbose output'); |
| 1547 | + }); |
| 1548 | + |
| 1549 | + it('should format item with description on next line when term is long', () => { |
| 1550 | + const result = formatItem('--very-long-option-name-here', 'desc', 10, 2, 2, 80); |
| 1551 | + expect(result).toContain('--very-long-option-name-here'); |
| 1552 | + expect(result).toContain('\n'); |
| 1553 | + expect(result).toContain('desc'); |
| 1554 | + }); |
| 1555 | + |
| 1556 | + it('should format item without description', () => { |
| 1557 | + const result = formatItem('--flag', '', 20, 2, 2, 80); |
| 1558 | + expect(result).toBe(' --flag'); |
| 1559 | + }); |
| 1560 | + }); |
1542 | 1561 | }); |
0 commit comments