{"id":16111779,"url":"https://github.com/cliffano/bagofcli","last_synced_at":"2025-07-22T02:38:05.282Z","repository":{"id":44713986,"uuid":"10417072","full_name":"cliffano/bagofcli","owner":"cliffano","description":"A library for defining CLI commands as JSON configuration","archived":false,"fork":false,"pushed_at":"2025-02-01T04:29:46.000Z","size":14419,"stargazers_count":2,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-21T02:51:58.880Z","etag":null,"topics":["cli","nodejs"],"latest_commit_sha":null,"homepage":"","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/cliffano.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-06-01T03:25:56.000Z","updated_at":"2025-02-01T04:29:50.000Z","dependencies_parsed_at":"2024-06-18T22:54:23.257Z","dependency_job_id":"31a1eac8-5080-4d8e-a695-fd59b473cb6f","html_url":"https://github.com/cliffano/bagofcli","commit_stats":{"total_commits":191,"total_committers":6,"mean_commits":"31.833333333333332","dds":"0.15706806282722519","last_synced_commit":"38de53b6f5a0b17339e416033f1d43e0342e3a86"},"previous_names":[],"tags_count":26,"template":false,"template_full_name":null,"purl":"pkg:github/cliffano/bagofcli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fbagofcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fbagofcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fbagofcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fbagofcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cliffano","download_url":"https://codeload.github.com/cliffano/bagofcli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cliffano%2Fbagofcli/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266413523,"owners_count":23924745,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","nodejs"],"created_at":"2024-10-09T19:45:31.699Z","updated_at":"2025-07-22T02:38:05.260Z","avatar_url":"https://github.com/cliffano.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" src=\"https://raw.github.com/cliffano/bagofcli/master/avatar.jpg\" alt=\"Avatar\"/\u003e\n\n[![Build Status](https://github.com/cliffano/bagofcli/workflows/CI/badge.svg)](https://github.com/cliffano/bagofcli/actions?query=workflow%3ACI)\n[![Security Status](https://snyk.io/test/github/cliffano/bagofcli/badge.svg)](https://snyk.io/test/github/cliffano/bagofcli)\n[![Dependencies Status](https://img.shields.io/librariesio/release/npm/bagofcli)](https://libraries.io/github/cliffano/bagofcli)\n[![Coverage Status](https://img.shields.io/coveralls/cliffano/bagofcli.svg)](https://coveralls.io/r/cliffano/bagofcli?branch=master)\n[![Published Version](https://img.shields.io/npm/v/bagofcli.svg)](http://www.npmjs.com/package/bagofcli)\n\u003cbr/\u003e\n\nBag Of CLI\n----------\n\nBag Of CLI contains CLI utility functions.\n\nThis is handy when you want to have a set of common CLI commands with descriptions, options, help, and example usages, by just defining them in a JSON file. Bag of CLI essentially allows you to define those info in a configuration file instead of code.\n\nInstallation\n------------\n\n    npm install bagofcli\n\nor as a dependency in package.json file:\n\n    \"dependencies\": {\n      \"bagofcli\": \"x.y.z\"\n    }\n\nUsage\n-----\n\nCommands:\n\n    // create conf/commands.json file containing commands configuration\n\n    {\n      \"options\": [\n        { \"arg\": \"-f, --file \u003cfile\u003e\", \"desc\": \"This is a global option, applicable to all commands.\" }\n      ],\n      \"commands\": {\n        \"command1\": {\n          \"desc\": \"This is the first command\",\n          \"options\": [\n            { \"arg\": \"-r, --registry \u003cregistry\u003e\", \"desc\": \"This is a command option, applicable only to command1\"}\n          ],\n          \"examples\": [\n            \"\u003cbin\u003e command1 --registry someregistry\"\n          ]\n        },\n        \"command2\": {\n          \"desc\": \"This is the second command\",\n          \"options\": [\n            { \"arg\": \"-d, --debug\", \"desc\": \"This is a command option, applicable only to command2\"}\n          ],\n          \"examples\": [\n            \"\u003cbin\u003e command2 --debug\"\n          ]\n        }\n      }\n    }\n\n    // setup command handlers\n\n    var bag = require('bagofcli');\n\n    var actions = {\n      commands: {\n        command1: {\n          action: function (args) {\n            console.log(args.registry);\n          }\n        },\n        command2: {\n          action: function (args) {\n            console.log(args.debug);\n          }\n        }\n      }\n    };\n\n    bag.command(__dirname, actions);\n\nCheck out [lib/bagofcli.js](https://github.com/cliffano/bagofcli/blob/master/lib/bagofcli.js) for more utility functions.\n\nUpgrade\n-------\n\nFrom 0.0.x to 0.1.x .\n\nUpdate commands.json argument validation rules:\n\n* `notEmpty` to `required`\n* `isNumeric` to `number`\n* `isEmail` to `email`\n\nCheck out [iz](http://npmjs.org/package/iz) for available validation rules.\n\nColophon\n--------\n\n[Developer's Guide](https://cliffano.github.io/developers_guide.html#nodejs)\n\nBuild reports:\n\n* [Code complexity report](https://cliffano.github.io/bagofcli/complexity/plato/index.html)\n* [Unit tests report](https://cliffano.github.io/bagofcli/test/mocha.txt)\n* [Test coverage report](https://cliffano.github.io/bagofcli/coverage/c8/index.html)\n* [API Documentation](https://cliffano.github.io/bagofcli/doc/jsdoc/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcliffano%2Fbagofcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcliffano%2Fbagofcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcliffano%2Fbagofcli/lists"}