@clerc/plugin-strict-flags
Version:
Clerc plugin strict flags
1 lines • 342 B
JavaScript
import{definePlugin as e}from"@clerc/core";import{joinWithAnd as t}from"@clerc/utils";const n=()=>e({setup:e=>{e.interceptor(async(e,n)=>{let r=Object.keys(e.rawParsed.unknown);if(!e.command||r.length===0)await n();else throw r.length>1?Error(`Unexpected flags: ${t(r)}`):Error(`Unexpected flag: ${r[0]}`)})}});export{n as strictFlagsPlugin};