Seems like there are a couple of base incompatibilities with parseArgs.
The docs show to use args: Bun.argv, but this includes the process name and file name so it needs to be .slice(2)'d otherwise you get a positional arguments error.
The part I'm stuck on at the moment is that aliases just don't work.
Minimal repro:
import Bun from "bun";
import { parseArgs } from "util"
const { values } = parseArgs({
args: Bun.argv.slice(2),
options: {
command: { type: 'string', default: 'start', alias: 'c' },
}
})
console.dir(values)
Output:
➜ basado git:(main) ✗ bun run src/index.ts -c doit
1 | import Bun from "bun";
2 | import { parseArgs } from "util"
3 |
4 | const { values } = parseArgs({
^
TypeError: Unexpected argument '/opt/homebrew/Cellar/bun/1.2.9/bin/bun'. This command does not take positional arguments
code: "ERR_PARSE_ARGS_UNEXPECTED_POSITIONAL"
at /Users/doinku/projects/ts/basado/src/index.ts:4:20
at loadAndEvaluateModule (2:1)
Bun v1.2.21 (macOS arm64)