{"id":16644226,"url":"https://github.com/75lb/command-line-commands","last_synced_at":"2025-09-21T23:16:00.212Z","repository":{"id":56564768,"uuid":"47020174","full_name":"75lb/command-line-commands","owner":"75lb","description":"Add a git-like command interface to your app.","archived":false,"fork":false,"pushed_at":"2024-09-16T23:09:32.000Z","size":200,"stargazers_count":41,"open_issues_count":0,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-26T20:59:24.239Z","etag":null,"topics":["cli","command-line","command-line-parser","command-line-tool","nodejs","option-parser"],"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/75lb.png","metadata":{"files":{"readme":"README.hbs","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-28T11:04:33.000Z","updated_at":"2024-09-16T23:09:35.000Z","dependencies_parsed_at":"2022-08-15T21:00:53.003Z","dependency_job_id":null,"html_url":"https://github.com/75lb/command-line-commands","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/75lb/command-line-commands","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-commands","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-commands/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-commands/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-commands/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/command-line-commands/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fcommand-line-commands/sbom","scorecard":{"id":5624,"data":{"date":"2025-08-11","repo":{"name":"github.com/75lb/command-line-commands","commit":"800b3b9111e7f6da6e1b647a5ef46ce77376fbc6"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 1/29 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/node.js.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/75lb/command-line-commands/node.js.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/75lb/command-line-commands/node.js.yml/master?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:29","Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:30","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-14T13:28:51.380Z","repository_id":56564768,"created_at":"2025-08-14T13:28:51.380Z","updated_at":"2025-08-14T13:28:51.380Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276318999,"owners_count":25621652,"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-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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","command-line","command-line-parser","command-line-tool","nodejs","option-parser"],"created_at":"2024-10-12T08:10:50.421Z","updated_at":"2025-09-21T23:16:00.187Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","readme":"[![view on npm](https://badgen.net/npm/v/command-line-commands)](https://www.npmjs.org/package/command-line-commands)\n[![npm module downloads](https://badgen.net/npm/dt/command-line-commands)](https://www.npmjs.org/package/command-line-commands)\n[![Gihub repo dependents](https://badgen.net/github/dependents-repo/75lb/command-line-commands)](https://github.com/75lb/command-line-commands/network/dependents?dependent_type=REPOSITORY)\n[![Gihub package dependents](https://badgen.net/github/dependents-pkg/75lb/command-line-commands)](https://github.com/75lb/command-line-commands/network/dependents?dependent_type=PACKAGE)\n[![Node.js CI](https://github.com/75lb/command-line-commands/actions/workflows/node.js.yml/badge.svg)](https://github.com/75lb/command-line-commands/actions/workflows/node.js.yml)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# command-line-commands\n\nA lightweight module to help build a git-like command interface for your app.\n\nIts job is to extract the command (the first argument, unless it's an option), check it's valid and either return it or throw. From there, you can parse the remaining args using your preferred option parser (e.g. [command-line-args](https://github.com/75lb/command-line-args), [minimist](https://github.com/substack/minimist) etc.).\n\n## Synopsis\n\nCreate a list of valid commands (`null` represents \"no command\"). Supply it to `commandLineCommands()`, receiving back an object with two properties: `command` (the supplied command) and `argv` (the remainder of the command line args):\n```js\nconst commandLineCommands = require('command-line-commands')\n\nconst validCommands = [ null, 'clean', 'update', 'install' ]\nconst { command, argv } = commandLineCommands(validCommands)\n\n/* print the command and remaining command-line args */\nconsole.log('command: %s', command)\nconsole.log('argv:    %s', JSON.stringify(argv))\n```\n\nWe'll assume the above script is installed as `example`. Since the `validCommands` list includes `null`, running it without a command is valid:\n```\n$ example\ncommand: null\nargv:    []\n```\n\nRunning `example` with no command and one option:\n```\n$ example --verbose\ncommand: null\nargv:    [\"--verbose\"]\n```\n\nRunning `example` with both a command and an option:\n```\n$ example install --save something\ncommand: install\nargv:    [\"--save\",\"something\"]\n```\n\nRunning `example` without a valid command will cause `commandLineCommands()` to throw.\n\nFrom here, you can make a decision how to proceed based on the `command` and `argv` received. For example, if no command (`null`) was passed, you could parse the remaining `argv` for general options (in this case using [command-line-args](https://github.com/75lb/command-line-args)):\n\n```js\nif (command === null) {\n  const commandLineArgs = require('command-line-args')\n  const optionDefinitions = [\n    { name: 'version', type: Boolean }\n  ]\n\n  // pass in the `argv` returned by `commandLineCommands()`\n  const options = commandLineArgs(optionDefinitions, { argv })\n\n  if (options.version) {\n    console.log('version 1.0.1')\n  }\n}\n```\n\nThe same example, using [minimist](https://github.com/substack/minimist):\n\n```js\nif (command === null) {\n  const minimist = require('minimist')\n\n  // pass in the `argv` returned by `commandLineCommands()``\n  const options = minimist(argv)\n\n  if (options.version) {\n    console.log('version 1.0.1')\n  }\n}\n```\n\n## More examples\n\nBoth examples use [command-line-args](https://github.com/75lb/command-line-args) for option-parsing.\n\n- [Simple](https://github.com/75lb/command-line-commands/blob/master/example/simple.js): A basic app with a couple of commands.\n- [Advanced](https://github.com/75lb/command-line-commands/blob/master/example/advanced/git.js): A more complete example, implementing part of the git command interface.\n\n## Usage guides\n\nUsage guides can be generated by [command-line-usage](https://github.com/75lb/command-line-usage). Here is a simple example ([code](https://github.com/75lb/command-line-commands/blob/master/example/usage.js)):\n\n![usage](https://raw.githubusercontent.com/75lb/command-line-commands/master/example/screens/command-list.png)\n\n# API Reference\n{{#module name=\"command-line-commands\"}}\n{{\u003ebody~}}\n{{\u003emember-index~}}\n{{\u003eseparator~}}\n{{\u003emembers~}}\n{{/module}}\n\n* * *\n\n\u0026copy; 2015-25 Lloyd Brookes \\\u003c75pound@gmail.com\\\u003e. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcommand-line-commands","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Fcommand-line-commands","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fcommand-line-commands/lists"}