{"id":19994200,"url":"https://github.com/b4dnewz/clito","last_synced_at":"2025-10-13T10:33:44.100Z","repository":{"id":57200461,"uuid":"177634271","full_name":"b4dnewz/clito","owner":"b4dnewz","description":"Simple and well written command line applications helper","archived":false,"fork":false,"pushed_at":"2020-09-04T22:58:14.000Z","size":407,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-24T17:48:07.268Z","etag":null,"topics":["bin","command-line","command-line-tool","helper","parser","utility"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/b4dnewz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-25T17:34:54.000Z","updated_at":"2020-10-18T18:17:36.000Z","dependencies_parsed_at":"2022-09-16T15:11:41.292Z","dependency_job_id":null,"html_url":"https://github.com/b4dnewz/clito","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4dnewz%2Fclito","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4dnewz%2Fclito/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4dnewz%2Fclito/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4dnewz%2Fclito/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/b4dnewz","download_url":"https://codeload.github.com/b4dnewz/clito/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/b4dnewz%2Fclito/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259114577,"owners_count":22807252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bin","command-line","command-line-tool","helper","parser","utility"],"created_at":"2024-11-13T04:54:19.250Z","updated_at":"2025-10-13T10:33:39.068Z","avatar_url":"https://github.com/b4dnewz.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clito\n\n\u003e Simple and well written command line applications helper\n\n[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coverage percentage][coveralls-image]][coveralls-url] [![Project License][license-image]][license-url]\n\n## What is clito?\n\n__Clito__, pronounced as in \"clitoris\", stands for __cli-tools__ and it's a well written command line application helper.\nIt will become your best friend when dealing with cli applications, once you start play with it you will like it more than any other tool. :smirk:\n\n![southpark-chef](banner.jpg)\n\nOops.. move along children, you are holding up the line, let see some features now..\n\n## Features\n\n- Parses arguments respecting types\n- Boolean defaults to false\n- Support required options\n- Support multiple option arguments\n- Support for option value validation\n- Negates flags when using the `--no-` prefix\n- Outputs version when `--version`\n- Build help string from options when called with `--help`\n- Customizable help usage and command examples\n\n## Getting started\n\nInstall the module using your favourite package manager:\n\n```\nnpm install clito\n```\n\nLoad it in your application code and set it up:\n\n```js\n#!/usr/bin/env node\n\nconst clito = require('clito');\nconst cli = clito({\n  usage: 'askme \u003cquestion\u003e',\n  flags: {\n    person: {\n      type: 'string',\n      alias: 'p',\n      default: 'chef'\n    }\n  },\n  examples: [\n    'askme -p \"ghandi\" \"Do you ever got angry?\"'\n  ]\n})\n\nconst {input, flags} = cli\nconst [question] = input\nif (!question || question === '') {\n  console.error('You must ask a question first!');\n  process.exit(1);\n}\n\nif (flags.person === 'chef') {\n  console.log('\u003e You gotta find the clitoris children.');\n} else {\n  // evaluate question and answer it\n}\n```\n\nThan run it with some input and options:\n\n```\n$ node ./index.js \"How do you make a girl love you more than other people?\"\n\u003e You gotta find the clitoris children.\n```\n\n## Options\n\nThe module can accept various options to customize the behavior or help string output.\n\n#### flags\n\nType: `Object`  \nRequired: `true`\n\nAn object of name paired flags that are going to be used as command options and parsed.\n\nA flag itself it's an object than can take various properties to describe how the flag should be parsed and outputted in help message:\n\n* __type__: The flag type that should be returned from parsing (_this field is required_)\n* __alias__: An alias for the flag (_dashes are added automatically_)\n* __description__: The flag description used in the help message\n* __default__: The flag default value in case not specified\n* __validation__: A validation function for the flag parsed value\n* __required__: Identify the flag as required, will throw an error if flag is missing\n* __multiple__: specify that the flag accept multiple arguments and should be parsed as array\n\nExample flag:\n\n```js\n{\n  foo: {\n    type: 'string',\n    alias: 'f',\n    description: 'A foo option',\n    default: 'bar',\n    validation: (v) =\u003e true,\n    required: false,\n    multiple: false\n  }\n}\n```\n\n#### banner\n\nType: `String`  \n\nAdd a custom banner string to be printed on top of `--help` message.\n\n#### usage\n\nType: `String`  \nDefault: `$ {pkg.name} \u003cinput\u003e`\n\nSet a custom usage string to be used in `--help` message.\n\n#### examples\n\nType: `String, String[]`\n\nAdd custom command usage examples to be appended on bottom of `--help` message.\n\n#### indentation\n\nType: `Number`  \nDefault: `0`\n\nSet the indentation size used in the built-in help message.\n\n#### showVersion\n\nType: `Boolean`  \nDefault: `true`\n\nShows the command version when called with `--version`.\n\n#### showHelp\n\nType: `Boolean`  \nDefault: `true`\n\nShows the built-in command help when called with `--help`.\n\n---\n\n## License\n\nThis package is under [MIT](LICENSE) license and its made with love by [Filippo Conti](https://b4dnewz.github.io/)\n\n\n[npm-image]: https://badge.fury.io/js/clito.svg\n\n[npm-url]: https://npmjs.org/package/clito\n\n[travis-image]: https://travis-ci.org/b4dnewz/clito.svg?branch=master\n\n[travis-url]: https://travis-ci.org/b4dnewz/clito\n\n[coveralls-image]: https://coveralls.io/repos/b4dnewz/clito/badge.svg\n\n[coveralls-url]: https://coveralls.io/r/b4dnewz/clito\n\n[license-image]: https://img.shields.io/badge/license-MIT-blue.svg\n\n[license-url]: https://github.com/b4dnewz/clito/blob/master/LICENSE\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb4dnewz%2Fclito","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fb4dnewz%2Fclito","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fb4dnewz%2Fclito/lists"}