{"id":51062509,"url":"https://github.com/dillionmegida/cross-cmd","last_synced_at":"2026-06-23T03:42:36.588Z","repository":{"id":57210753,"uuid":"256761084","full_name":"dillionmegida/cross-cmd","owner":"dillionmegida","description":"Cross platform CLI commands","archived":false,"fork":false,"pushed_at":"2020-04-19T23:24:08.000Z","size":13,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-03-09T16:57:57.268Z","etag":null,"topics":["cli","cross-platform","darwin","linux","nodejs","win32"],"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/dillionmegida.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}},"created_at":"2020-04-18T13:31:00.000Z","updated_at":"2024-04-23T18:40:48.000Z","dependencies_parsed_at":"2022-08-31T04:01:34.590Z","dependency_job_id":null,"html_url":"https://github.com/dillionmegida/cross-cmd","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dillionmegida/cross-cmd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillionmegida%2Fcross-cmd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillionmegida%2Fcross-cmd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillionmegida%2Fcross-cmd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillionmegida%2Fcross-cmd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dillionmegida","download_url":"https://codeload.github.com/dillionmegida/cross-cmd/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dillionmegida%2Fcross-cmd/sbom","scorecard":{"id":342991,"data":{"date":"2025-08-11","repo":{"name":"github.com/dillionmegida/cross-cmd","commit":"ad0df1d3852b2d9decc59b32976d709dcac92988"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/9 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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"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":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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":"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":"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 1 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-18T06:21:49.665Z","repository_id":57210753,"created_at":"2025-08-18T06:21:49.665Z","updated_at":"2025-08-18T06:21:49.665Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34674702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"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","cross-platform","darwin","linux","nodejs","win32"],"created_at":"2026-06-23T03:42:35.934Z","updated_at":"2026-06-23T03:42:36.578Z","avatar_url":"https://github.com/dillionmegida.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cross-cmd ✨\n\nCross-platform CLI commands\n\n## The problem\n\nI was trying to create a CLI package using my linux system, and I wanted to trigger a command that reads a file. Being linux, I used `cat` and it worked perfectly. **But**, for people using my package on a different operating system like windows, they'd never be able to trigger a command like `cat`.\n\n## This Solution\n\nThis CLI package has many commands with different purposes mapped to different operating system commands. You give it a command and the required options, and it runs the appropriate command for the platform is used with the options provided.\n\n## Usage\n\nThis library comes in handy when creating a CLI package and you want to target various platforms.\n\n**Note that** this is a javascript library.\n\n### Installation\n\n```shell\nnpm i cross-cmd\n```\n\n### In your project\n\nLet's say you use `spawnSync` from the [child_process](https://nodejs.org/api/child_process.html) module in NodeJS (it could be any function, as long as it executes terminal commands) and you're developing your package on a linux system:\n\n```js\nconst {spawnSync} = require('child_process');\nspawnSync('node', ['./node_modules/cross-cmd', 'cat', 'path-to-file'], {\n    stdio: \"inherit\"\n})\n```\n\nWhat happens here is that `cross-cmd` checks its [list of commands](./src/commands.js), gets the one with `cat` and appropriately apply the command for the platform it is being run on. For example, your package with this command executed on linux and windows respectively would be:\n\n```shell\n# linux\ncat path-to-file\n# windows\ntype path-to-file\n```\n\nThis is because 'type' is a win32 representative associated with linux's 'cat' as saved in the [list of commands](./src/commands.js).\n\n\u003e `cross-cmd` is not installed globally, that's why it is accessed with `node ./node_modules...` instead of `cross-cmd...`. Just as I wouldn't want the users of this package to have it installed globally against their will, the users wouldn't also want the users of their packages to do the same.\n\nIf the command does not exist, it throws an error. When this happens, you can do me and the community a favor by [creating a feature request issue](https://github.com/dillionmegida/cross-cmd/issues/new) of the command you want to be added.\n\n#### For commands with spaces\n\ne.g `type nul \u003e` which creates an empty file in windows as `touch` does in linux and is saved in the command list, a windows user of this package would have to do the following:\n\n```js\nconst {spawnSync} = require('child_process');\nspawnSync('node', ['./node_modules/cross-cmd', 'type nul \u003e', 'path-to-file'], {\n    stdio: \"inherit\"\n})\n```\n\n`cross-cmd` changes the command 'type nul \u003e' depending on the os.\n\n## All commands\n\nIt is important to **confirm that a command exists** before using it in your package. You can run the following to confirm that a command exists:\n\n```shell\nnode ./node_modules cross_cmd \u003ccommand-name\u003e --help\n```\n\nOr find all commands available [here](/src/allcommands.md).\n\n## Issues and Contributions\n\nYour contribution to this project would be highly appreciated. Could be a documentation issue, pull request, feature request, they are all welcome.\n\n- [Create a pull request](https://github.com/dillionmegida/cross-cmd/pulls)\n- [Open an issue](https://github.com/dillionmegida/cross-cmd/issues)\n\n## LICENSE\n\n[MIT](/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillionmegida%2Fcross-cmd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdillionmegida%2Fcross-cmd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdillionmegida%2Fcross-cmd/lists"}