{"id":18220,"library":"cli","title":"cli","description":"A full-featured command-line application toolkit for Node.js (v1.0.1, latest, infrequently updated). Provides argument parsing, plugin support, colored output, progress bars, spinners, auto-completion, and stdin helpers. Differentiates from yargs and commander by its inclusive feature set and mature legacy API.","status":"maintenance","version":"1.0.1","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/node-js-libs/cli","tags":["javascript","cli","command line","opts","parseopt","opt","args","console","argsparse"],"install":[{"cmd":"npm install cli","lang":"bash","label":"npm"},{"cmd":"yarn add cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add cli","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"CommonJS only; this package predates ESM and has no ESM entry.","symbol":"cli","correct":"const cli = require('cli')"},{"note":"Main module is a function; parse is a method on it.","wrong":"const { parse } = require('cli'); parse(options)","symbol":"cli.parse","correct":"cli.parse(options)"},{"note":"Must be called on the cli object.","wrong":"withStdin(callback)","symbol":"cli.withStdin","correct":"cli.withStdin(callback)"}],"quickstart":{"code":"const cli = require('cli');\n\ncli.parse({\n  file: ['f', 'A file to process', 'file', 'temp.log'],\n  time: ['t', 'An access time', 'time', false],\n  work: [false, 'What kind of work to do', 'string', 'sleep']\n});\n\ncli.withStdinLines((lines, newline) => {\n  if (cli.options.file) {\n    cli.output(`File option: ${cli.options.file}`);\n  }\n  cli.output(lines.join(newline));\n});","lang":"javascript","description":"Shows parsing CLI arguments with descriptions and defaults, then processing stdin lines and using parsed options."},"warnings":[{"fix":"Use require('cli') instead of import.","message":"The package is old and uses CommonJS only; there is no ESM version.","severity":"gotcha","affected_versions":">=0.2.5"},{"fix":"Assign to a variable and use its methods.","message":"The default export is a function; calling require('cli')() is incorrect.","severity":"gotcha","affected_versions":">=0.2.5"},{"fix":"Consider migrating to a maintained library.","message":"The package is not actively maintained; newer alternatives like yargs or commander exist.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Test on target shells.","message":"Auto-completion feature may not work in all environments.","severity":"gotcha","affected_versions":">=0.2.5"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"const cli = require('cli'); then cli.withStdin(...)","cause":"Attempting to call withStdin without requiring cli correctly.","error":"TypeError: cli.withStdin is not a function"},{"fix":"Run 'npm install cli' and ensure it is in node_modules.","cause":"Missing npm install or incorrect require path.","error":"Error: Cannot find module 'cli'"},{"fix":"Add 'const cli = require('cli');' at the top.","cause":"Trying to use cli without requiring it.","error":"ReferenceError: cli is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}