{"id":13562771,"url":"https://github.com/kotborealis/chen","last_synced_at":"2025-03-17T15:31:02.723Z","repository":{"id":57197739,"uuid":"81817716","full_name":"kotborealis/chen","owner":"kotborealis","description":":smiley_cat: Node.JS tool to parse cli arguments, enviroment variables and load configs from .js files","archived":false,"fork":false,"pushed_at":"2022-12-23T10:58:32.000Z","size":188,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T00:51:45.156Z","etag":null,"topics":["args","chen","cli","config","env","js","nodejs"],"latest_commit_sha":null,"homepage":"https://awooo.ru/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kotborealis.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-13T11:26:16.000Z","updated_at":"2023-03-08T03:34:18.000Z","dependencies_parsed_at":"2023-01-30T18:15:26.382Z","dependency_job_id":null,"html_url":"https://github.com/kotborealis/chen","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotborealis%2Fchen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotborealis%2Fchen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotborealis%2Fchen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kotborealis%2Fchen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kotborealis","download_url":"https://codeload.github.com/kotborealis/chen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243865625,"owners_count":20360475,"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":["args","chen","cli","config","env","js","nodejs"],"created_at":"2024-08-01T13:01:12.131Z","updated_at":"2025-03-17T15:31:02.292Z","avatar_url":"https://github.com/kotborealis.png","language":"JavaScript","readme":"![Cheeen~](./img/chen.png)\n\n# Chen.js :smiley_cat:\n\n:smiley_cat: Node.JS tool to parse cli arguments, enviroment variables and load configs from .js files \n\n## CLI arguments parser\n\n```js\n// Called with args:\n// --prop 100 --flag -abc input output --type=\"pdf document\" -- \"more unnamed args\" -not-a-a-flag\n\nrequire('chen.js').args();\n\n/**\n{\n\t_: ['input', 'output', 'more unnamed args', '-not-a-a-flag'],\n\tprop: 100,\n\tflag: true,\n\ta: true,\n\tb: true,\n    c: true,\n\ttype: 'pdf document',\n}\n**/\n```\n\n## Config loader\n\n```js\n/**\n* Loads `${PWD}/.config.js` by default\n*/\nconst config = require('chen.js').config();\n```\n\n```js\n/**\n* Loads `${PWD}/.cfg.js`\n*/\nconst config = require('chen.js').config('.cfg.js');\n```\n\n```js\n/**\n* Loads `${PWD}/.config.js`\n* Loads `${PWD}/.config.dev.js` and overrides previous config\n*/\nconst config = require('chen.js').config(['.config.js', '.config.dev.js']);\n```\n\n```js\n/**\n* Assuming called with CLI args: --config=.config.dev.js\n* Loads `${PWD}/.config.js`\n* Loads `${PWD}/.config.dev.js` and overrides previous config\n*/\nconst config = require('chen.js').config();\n```\n\n```js\n/**\n* Assuming called with CLI args: --config=.config.dev.js --config=.config.dev2.js\n* Loads `${PWD}/.config.js`\n* Loads `${PWD}/.config.dev.js` and overrides previous config\n* Loads `${PWD}/.config.dev2.js` and overrides previous config\n*/\nconst config = require('chen.js').config();\n```\n\n## Env parser\n\nLoads and parses environment variables and .env files (via dotenv package).\n\n```js\nconst env = require('chen').env();\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotborealis%2Fchen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkotborealis%2Fchen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkotborealis%2Fchen/lists"}