⚡ Zero-dependency plcbundle library exclusively for Bun
5
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 523998b90160be9cac7576c409cf37f090c83f2c 53 lines 1.4 kB view raw
1#!/usr/bin/env bun 2 3import { clone } from './cmds/clone'; 4import { detect } from './cmds/detect'; 5import { info } from './cmds/info'; 6import { verify } from './cmds/verify'; 7import { exportCmd } from './cmds/export'; 8 9const commands = { 10 clone, 11 detect, 12 info, 13 verify, 14 export: exportCmd, 15 16 help() { 17 console.log(` 18plcbundle - Work with PLC bundle archives 19 20USAGE: 21 bun cli <command> [options] 22 23COMMANDS: 24 clone Clone bundles from a remote repository 25 detect Detect and filter operations using a custom function 26 info Show index or bundle information 27 verify Verify bundle integrity 28 export Export operations from bundle 29 help Show this help 30 31Use 'bun cli <command> -h' for command-specific help 32 33EXAMPLES: 34 bun cli clone --remote https://plcbundle.atscan.net 35 bun cli info --dir ./bundles 36 bun cli detect --detect ./examples/detect.ts 37 bun cli detect --detect ./examples/detect.ts --bundles 1-100 38 bun cli detect --detect ./examples/detect.ts --bundles 42 --threads 4 39 bun cli verify --bundle 42 40 bun cli export --bundle 1 > ops.jsonl 41 `); 42 }, 43}; 44 45// Main 46const [command, ...args] = process.argv.slice(2); 47 48if (!command || command === '-h' || command === '--help' || !commands[command as keyof typeof commands]) { 49 commands.help(); 50 process.exit(command && command !== '-h' && command !== '--help' ? 1 : 0); 51} 52 53await commands[command as keyof typeof commands](args);