{"id":13501494,"url":"https://github.com/cuducos/createnv","last_synced_at":"2025-03-17T14:15:58.490Z","repository":{"id":62565311,"uuid":"248333250","full_name":"cuducos/createnv","owner":"cuducos","description":"🧞‍♀️Automagically creates .env files","archived":false,"fork":false,"pushed_at":"2024-12-01T00:55:24.000Z","size":71,"stargazers_count":42,"open_issues_count":4,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-02T13:09:07.334Z","etag":null,"topics":["cli","dev","developer-tools","devtools","dotenv","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cuducos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["cuducos"]}},"created_at":"2020-03-18T20:15:25.000Z","updated_at":"2025-01-22T19:28:29.000Z","dependencies_parsed_at":"2024-10-28T09:14:56.098Z","dependency_job_id":"2fa65b9d-e2e7-4150-a610-71dccfd7c020","html_url":"https://github.com/cuducos/createnv","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fcreatenv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fcreatenv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fcreatenv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cuducos%2Fcreatenv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cuducos","download_url":"https://codeload.github.com/cuducos/createnv/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047645,"owners_count":20389206,"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":["cli","dev","developer-tools","devtools","dotenv","hacktoberfest"],"created_at":"2024-07-31T22:01:39.369Z","updated_at":"2025-03-17T14:15:58.452Z","avatar_url":"https://github.com/cuducos.png","language":"Rust","readme":"# Createnv [![Tests](https://github.com/cuducos/createnv/actions/workflows/tests.yml/badge.svg)](https://github.com/cuducos/createnv/actions/workflows/tests.yml)\nA simple CLI to create `.env` files.\n\n## Motivation\n\nI use `.env` file to decouple configuration from application in many projects, and I see that many newcomers might struggle in creating this file.\n\nThus, I created this package to offer a better user interface for creating configuration files in the format of `.env`.\n\n## Example\n\nUsing the sample `.env.sample` in this repository:\n\n[![asciicast](https://asciinema.org/a/311482.svg)](https://asciinema.org/a/311482)\n\nYou can now experiment by yourself, or try more advanced `.env.sample` such as the `tests/.env.sample` or [Bot Followers's `.env.sample`](https://github.com/cuducos/bot-followers/blob/master/.env.sample).\n\n## Install\n\nYou can download the binary for your platform from the [releases page](https://github.com/cuducos/createnv/releases), for example:\n\n```console\n$ curl -LO https://github.com/cuducos/createnv/releases/download/v0.0.3/createnv-x86_64-unknown-linux-gnu.tar.gz\n$ tar -xzvf createnv-x86_64-unknown-linux-gnu.tar.gz\n$ rm createnv-x86_64-unknown-linux-gnu.tar.gz\n$ chmod a+x createnv \n$ mv createnv /usr/local/bin/\n```\n\n### Compile from source\n\nIt is simple with [Rust's `cargo`](https://www.rust-lang.org/tools/install):\n\n```console\n$ cargo install --path .\n```\n\n## Usage\n\nTo use the default values (reads the sample from `.env.sample` and write the result into `.env`):\n\n```console\n$ createnv\n```\n\n### Options\n\n| Option | Description | Default |\n|---|---|---|\n| `--target` | File to write the result | `.env` |\n| `--source` | File to use as a sample | `.env.sample` |\n| `--chars-for-random-string` | Characters used to create random strings | All ASCII letters, numbers and a few extra characters (`!@#$%^\u0026*(-_=+)`) |\n\n### Flags\n\n| Option | Description |\n|---|---|\n| `--stdout` | Write to `stdout` instead of a file |\n| `--overwrite` | Do not ask before overwriting files |\n| `--use-default`  | Do not ask for input on fields that have a default value |\n\n## Format of sample files\n\nCreatenv reads the sample file and separate lines in blocks, splitting at empty lines. It follows a few rules:\n\n1. The first line is required to be a **title**\n2. The second line might be a **description** or a **variable**\n3. The remaining lines should be **variables**\n\n### Title\n\nThe first line of the block should start with a `#` character, followed by a space. The title value is the remaining text after the `#` and space.\n\n#### Example\n\n```\n# Hell Yeah!\n```\n\nIn this case, the title is _Hell yeah!_ (not _# Hell yeah!_).\n\n### Description (_optional_)\n\nIf the second line follows the syntax of a _title_ line, it's text (without the `# `) is considered a _description_ and is used to give more information to the user about the variables from this block.\n\n### Variables\n\nThere are three types of variables:\n\n#### Regular\n\nEach block might one or more variable lines. The syntax requires a _name of variable_ using only capital letters, numbers, or underscore, followed by an equal sign.\n\nWhat comes after the equal sign is _optional_. This text is considered the default value of this variable.\n\nThe human description of this variable is also _optional_. You can create one by placing a comment at the end of the line.  That is to say, any text after a sequence of **two spaces, followed by the `#` sign and one extra space**, is the human description of that variable.\n\n##### Example\n\n```\nNAME=\n```\n\nThis is a valid variable line. It has a name (_NAME_), no default value, and no human description. We can add a default value:\n\n```\nNAME=Cuducos\n```\n\nThis is still a valid variable line. It has a name(_NAME_), and a default value (_Cuducos_). Yet, we can add a human description:\n\n```\nNAME=Cuducos  # What is your name?\n```\n\nNow it's a complete variable with a name (_NAME_), a default value (_Cuducos_), and a human description (_What is your name?_)\n\n#### Random values\n\nIf you want to have a variable with a random value, you can set its default value to `\u003crandom\u003e` and Createnv will take care of it. Optionally you can specify how long this variable should be with `:int`.\n\nYou can use the `--chars-for-random-string` option to specify which characters to be used in the random value.\n\n##### Example\n\n```\nSECRET_KEY=\u003crandom\u003e\nTOKEN=\u003crandom:32\u003e\n```\n\nThe first line will create a `SECRET_VALUE` with random characters and random length between 64 and 128 chars.\n\nThe second line will create a `TOKEN` with random value and with exactly 32 characters.\n\n#### Auto generated\n\nFinally, you can combine existing variables _within the same block_ to create a new variable (without prompting your user to combine them), the syntax is similar to f-strings in Python..\n\n##### Example\n\n```\nNAME=  # What is your name?\nPERIOD=  # Is it morning, afternoon, or evening?\nGREETING=Good {PERIOD}, {NAME}!\n```\n\nIn this case, Createnv only asks the user for `NAME` and `PERIOD`, and creates `GREETING` automagically.\n","funding_links":["https://github.com/sponsors/cuducos"],"categories":["Rust","Shell/Terminal"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuducos%2Fcreatenv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcuducos%2Fcreatenv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcuducos%2Fcreatenv/lists"}