GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — claude-code-source-code/src/commands/plugin/parseArgs.ts at main · wangwang4git/claude-code-source-code Expand file tree/ Copy pathparseArgs.tsMore file actions 103 lines (87 loc) · 2.75 KB / Copy pathparseArgs.tsFile metadata and controls103 lines (87 loc) · 2.75 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 // Parse plugin subcommand arguments into structured commands export type ParsedCommand = | { type: 'menu' } | { type: 'help' } | { type: 'install'; marketplace?: string; plugin?: string } | { type: 'manage' } | { type: 'uninstall'; plugin?: string } | { type: 'enable'; plugin?: string } | { type: 'disable'; plugin?: string } | { type: 'validate'; path?: string } | { type: 'marketplace' action?: 'add' | 'remove' | 'update' | 'list' target?: string } export function parsePluginArgs(args?: string): ParsedCommand { if (!args) { return { type: 'menu' } } const parts = args.trim().split(/\s+/) const command = parts[0]?.toLowerCase() switch (command) { case 'help': case '--help': case '-h': return { type: 'help' } case 'install': case 'i': { const target = parts[1] if (!target) { return { type: 'install' } } // Check if it's in format plugin@marketplace if (target.includes('@')) { const [plugin, marketplace] = target.split('@') return { type: 'install', plugin, marketplace } } // Check if the target looks like a marketplace (URL or path) const isMarketplace = target.startsWith('http://') || target.startsWith('https://') || target.startsWith('file://') || target.includes('/') || target.includes('\\') if (isMarketplace) { // This is a marketplace URL/path, no plugin specified return { type: 'install', marketplace: target } } // Otherwise treat it as a plugin name return { type: 'install', plugin: target } } case 'manage': return { type: 'manage' } case 'uninstall': return { type: 'uninstall', plugin: parts[1] } case 'enable': return { type: 'enable', plugin: parts[1] } case 'disable': return { type: 'disable', plugin: parts[1] } case 'validate': { const target = parts.slice(1).join(' ').trim() return { type: 'validate', path: target || undefined } } case 'marketplace': case 'market': { const action = parts[1]?.toLowerCase() const target = parts.slice(2).join(' ') switch (action) { case 'add': return { type: 'marketplace', action: 'add', target } case 'remove': case 'rm': return { type: 'marketplace', action: 'remove', target } case 'update': return { type: 'marketplace', action: 'update', target } case 'list': return { type: 'marketplace', action: 'list' } default: // No action specified, show marketplace menu return { type: 'marketplace' } } } default: // Unknown command, show menu return { type: 'menu' } } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |