antongolub/credebug

View on GitHub
src/main/js/cli.min.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
#!/usr/bin/env node
let entries=process.argv.map(((t,e,s)=>{if(!t.startsWith("--"))return;const[r,n]=t.slice(2).split("=");return[r,n||s[e+1]&&!s[e+1]?.startsWith("--")]})).filter(Boolean);entries.length||(entries=Object.entries(process.env));let status=0;const result=entries.reduce(((t,[e,s])=>{const r=s?"***":"<empty>",n=/^[a-zA-Z_]+$/.test(e)?e:"***";return s||(status=1),`${t}\n${n}: ${r}`}),"");console.log(result),process.exit(status);