Skip to main content
Module

x/cliffy/examples/flags/error_handling.ts

Command line framework for deno 🦕 Including Commandline-Interfaces, Prompts, CLI-Table, Arguments Parser and more...
Extremely Popular
Go to Latest
File
#!/usr/bin/env -S deno run
import { parseFlags, ValidationError } from "../../flags/mod.ts";
try { const flags = parseFlags(Deno.args, { flags: [{ name: "debug", }], }); console.log(flags);} catch (error) { // Command validation error. if (error instanceof ValidationError) { console.log("[VALIDATION_ERROR] %s", error.message); Deno.exit(1); } // General error or invalid configuration. throw error;}