{"id":13562766,"url":"https://github.com/rrwen/yargs-command-env","last_synced_at":"2025-04-03T07:19:56.435Z","repository":{"id":57156957,"uuid":"116438105","full_name":"rrwen/yargs-command-env","owner":"rrwen","description":"Yargs command for managing environment files","archived":false,"fork":false,"pushed_at":"2018-01-22T02:42:27.000Z","size":1243,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-08T21:11:18.530Z","etag":null,"topics":["args","argument","cli","command","default","dotenv","edit","env","environment","file","interface","line","manage","option","parser","parsing","save","settings","variable","yargs"],"latest_commit_sha":null,"homepage":"https://rrwen.github.io/yargs-command-env","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/rrwen.png","metadata":{"files":{"readme":"README.md","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":"2018-01-05T23:42:36.000Z","updated_at":"2021-08-21T00:05:11.000Z","dependencies_parsed_at":"2022-09-03T16:51:08.421Z","dependency_job_id":null,"html_url":"https://github.com/rrwen/yargs-command-env","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/rrwen%2Fyargs-command-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fyargs-command-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fyargs-command-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rrwen%2Fyargs-command-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rrwen","download_url":"https://codeload.github.com/rrwen/yargs-command-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246952278,"owners_count":20859813,"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","argument","cli","command","default","dotenv","edit","env","environment","file","interface","line","manage","option","parser","parsing","save","settings","variable","yargs"],"created_at":"2024-08-01T13:01:12.090Z","updated_at":"2025-04-03T07:19:56.410Z","avatar_url":"https://github.com/rrwen.png","language":"JavaScript","readme":"# yargs-command-env\n\nRichard Wen  \nrrwen.dev@gmail.com  \n\n* [Documentation](https://rrwen.github.io/yargs-command-env)\n\nYargs command for managing environment files\n\n[![npm version](https://badge.fury.io/js/yargs-command-env.svg)](https://badge.fury.io/js/yargs-command-env)\n[![Build Status](https://travis-ci.org/rrwen/yargs-command-env.svg?branch=master)](https://travis-ci.org/rrwen/yargs-command-env)\n[![Coverage Status](https://coveralls.io/repos/github/rrwen/yargs-command-env/badge.svg?branch=master)](https://coveralls.io/github/rrwen/yargs-command-env?branch=master)\n[![npm](https://img.shields.io/npm/dt/yargs-command-env.svg)](https://www.npmjs.com/package/yargs-command-env)\n[![GitHub license](https://img.shields.io/github/license/rrwen/yargs-command-env.svg)](https://github.com/rrwen/yargs-command-env/blob/master/LICENSE)\n[![Donate](https://img.shields.io/badge/donate-Donarbox-yellow.svg)](https://donorbox.org/rrwen)\n[![Twitter](https://img.shields.io/twitter/url/https/github.com/rrwen/yargs-command-env.svg?style=social)](https://twitter.com/intent/tweet?text=Yargs%20command%20for%20managing%20environment%20files:%20https%3A%2F%2Fgithub.com%2Frrwen%2Fyargs-command-env%20%23nodejs%20%23npm)\n\n## Install\n\n1. Install [Node.js](https://nodejs.org/en/)\n2. Install [yargs-command-env](https://www.npmjs.com/package/yargs-command-env) via `npm`\n\n```\nnpm install --save yargs-command-env\n```\n\nFor the latest developer version, see [Developer Install](#developer-install).\n\n## Usage\n\nCreate a file named `bin.js` with the following contents:\n\n```javascript\nvar yargs = require('yargs');\n\n// (env) Load command with path to env file\n// Replace './path/to/.env' with your .env file\nvar env = require('yargs-command-env')({file: './path/to/.env'});\n\n// (yargs) Add command to manage env file\nvar argv = yargs.command(env).argv;\n```\n\nDisplay help options for `bin.js` using [node](https://nodejs.org/api/cli.html):\n\n```\nnode bin.js env help\n```\n\nThe following will be displayed:\n\n```\nbin env \u003ctask\u003e [key] [value] [--env]\n\nmanage default env\n\n\u003ctask\u003e is one of:\n\n* set\n* delete\n* view\n* clear\n* reset\n\nSet variable to value\n\u003e set [key] [value]\n\nRemove default variable\n\u003e delete [key]\n\nView default variable\n\u003e view\n\nClear default variable\n\u003e clear\n\nReset default variable\n\u003e reset\n\nManage other env file\n\u003e set [key] [value] --env other.env\n\u003e delete [key] --env other.env\n\u003e view --env other.env\n\u003e clear --env other.env\n\u003e reset --env other.env\n```\n\nDefault env files are managed with the commands below:\n\n```\nnode bin.js env view\nnode bin.js env clear\nnode bin.js env reset\nnode bin.js env set key value\nnode bin.js env delete key\n```\n\nOther env files are managed by passing a path in the option `--env`:\n\n```\nnode bin.js env view --env .env\nnode bin.js env clear --env .env\nnode bin.js env reset --env .env\nnode bin.js env set key value --env .env\nnode bin.js env delete key --env .env\n```\n\nSee [Documentation](https://rrwen.github.io/yargs-command-env) for more details.\n\n## Contributions\n\n### Report Contributions\n\nReports for issues and suggestions can be made using the [issue submission](https://github.com/rrwen/yargs-command-env/issues) interface.\n\nWhen possible, ensure that your submission is:\n\n* **Descriptive**: has informative title, explanations, and screenshots\n* **Specific**: has details of environment (such as operating system and hardware) and software used\n* **Reproducible**: has steps, code, and examples to reproduce the issue\n\n### Code Contributions\n\nCode contributions are submitted via [pull requests](https://help.github.com/articles/about-pull-requests/):\n\n1. Ensure that you pass the [Tests](#tests)\n2. Create a new [pull request](https://github.com/rrwen/yargs-command-env/pulls)\n3. Provide an explanation of the changes\n\nA template of the code contribution explanation is provided below:\n\n```\n## Purpose\n\nThe purpose can mention goals that include fixes to bugs, addition of features, and other improvements, etc.\n\n## Description\n\nThe description is a short summary of the changes made such as improved speeds or features, and implementation details.\n\n## Changes\n\nThe changes are a list of general edits made to the files and their respective components.\n* `file_path1`:\n\t* `function_module_etc`: changed loop to map\n\t* `function_module_etc`: changed variable value\n* `file_path2`:\n\t* `function_module_etc`: changed loop to map\n\t* `function_module_etc`: changed variable value\n\n## Notes\n\nThe notes provide any additional text that do not fit into the above sections.\n```\n\nFor more information, see [Developer Install](#developer-install) and [Implementation](#implementation).\n\n## Developer Notes\n\n### Developer Install\n\nInstall the latest developer version with `npm` from github:\n\n```\nnpm install git+https://github.com/rrwen/yargs-command-env\n```\n  \nInstall from `git` cloned source:\n\n1. Ensure [git](https://git-scm.com/) is installed\n2. Clone into current path\n3. Install via `npm`\n\n```\ngit clone https://github.com/rrwen/yargs-command-env\ncd yargs-command-env\nnpm install\n```\n\n### Tests\n\n1. Clone into current path `git clone https://github.com/rrwen/yargs-command-env`\n2. Enter into folder `cd yargs-command-env`\n3. Ensure [devDependencies](https://docs.npmjs.com/files/package.json#devdependencies) are installed and available\n4. Run tests\n5. Results are saved to [tests/log](tests/log) with each file corresponding to a version tested\n\n```\nnpm install\nnpm test\n```\n\n### Documentation\n\nUse [documentationjs](https://www.npmjs.com/package/documentation) to generate html documentation in the `docs` folder:\n\n```\nnpm run docs\n```\n\nSee [JSDoc style](http://usejsdoc.org/) for formatting syntax.\n\n### Upload to Github\n\n1. Ensure [git](https://git-scm.com/) is installed\n2. Inside the `yargs-command-env` folder, add all files and commit changes\n3. Push to github\n\n```\ngit add .\ngit commit -a -m \"Generic update\"\ngit push\n```\n\n### Upload to npm\n\n1. Update the version in `package.json`\n2. Run tests and check for OK status\n3. Generate documentation\n4. Login to npm\n5. Publish to npm\n\n```\nnpm test\nnpm run docs\nnpm login\nnpm publish\n```\n\n### Implementation\n\nThe module [yargs-command-env](https://www.npmjs.com/package/yargs-command-env) uses the following npm packages for its implementation:\n\nnpm | Purpose\n--- | ---\n[yargs](https://www.npmjs.com/package/yargs)| Manage command line arguments and options\n[envfile](https://www.npmjs.com/package/envfile) | Parse and stringify [.env](https://www.npmjs.com/package/dotenv) files and objects \n[fs](https://nodejs.org/api/fs.html) | Read and write [.env](https://www.npmjs.com/package/dotenv) files\n\n```\n  yargs   \u003c-- CLI arguments\n    |\n envfile  \u003c-- Parse and stringify .env files\n    |\n   fs     \u003c-- Read and write .env files\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrwen%2Fyargs-command-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frrwen%2Fyargs-command-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frrwen%2Fyargs-command-env/lists"}