// builtin
import { argv, stdout, exit } from 'node:process'

// local
import scan, { stringify } from './index.ts'

// for each path, readdir
for (const path of argv.slice(2)) {
	scan(path)
		.then((result) => {
			// stdout.write(Object.keys(result).join('\n') + '\n')
			stdout.write(stringify(result, '  ') + '\n')
		})
		.catch((error) => {
			console.error(error)
			exit(1)
		})
}
