{"id":16406160,"url":"https://github.com/itchyny/fillin","last_synced_at":"2025-03-16T16:32:02.309Z","repository":{"id":66149618,"uuid":"93948476","full_name":"itchyny/fillin","owner":"itchyny","description":"fill-in your command and execute","archived":false,"fork":false,"pushed_at":"2021-09-18T14:41:27.000Z","size":104,"stargazers_count":149,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-16T04:04:08.815Z","etag":null,"topics":["cli-utility","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/itchyny.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-10T15:33:51.000Z","updated_at":"2025-03-13T19:37:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"624b70f0-ed67-49d2-96f1-e0e61f1bc1ee","html_url":"https://github.com/itchyny/fillin","commit_stats":null,"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchyny%2Ffillin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchyny%2Ffillin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchyny%2Ffillin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itchyny%2Ffillin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itchyny","download_url":"https://codeload.github.com/itchyny/fillin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243896503,"owners_count":20365387,"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-utility","go","golang"],"created_at":"2024-10-11T06:08:51.032Z","updated_at":"2025-03-16T16:32:02.034Z","avatar_url":"https://github.com/itchyny.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fillin\n[![CI Status](https://github.com/itchyny/fillin/workflows/CI/badge.svg)](https://github.com/itchyny/fillin/actions)\n[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/itchyny/fillin/blob/main/LICENSE)\n[![release](https://img.shields.io/github/release/itchyny/fillin/all.svg)](https://github.com/itchyny/fillin/releases)\n\n### fill-in your command and execute\n#### ― _separate action and environment of your command!_ ―\n\n## Motivation\nWe rely on shell history in our terminal operation.\nWe search from our shell history and execute commands dozens times in a day.\n\nSome programmers execute same commands switching servers.\nWe do not just login with `ssh {{hostname}}`, we also connect to the database with `psql -h {{psql:hostname}} -U {{psql:username}} -d {{psql:dbname}}` and to Redis server with `redis-cli -h {{redis:hostname}} -p {{redis:port}}`.\nWe switch the host argument from the localhost (you may omit this), staging and production servers.\n\nSome command line tools allow us to login cloud services and retrieve data from our terminal.\nMost of such cli tools accept an option to switching between our accounts.\nFor example, AWS command line tool has `--profile` option.\nOther typical names of options are `--region`, `--conf` and `--account`.\nWhen we specify these options directly, there are quadratic number of commands; the number of accounts times the number of actions.\nThe `fillin` allows us to save the command something like `aws --profile {{aws:profile}} ec2 describe-instances` so we'll not be bothered by the quadratic combinations of commands while searching through the shell history.\n\nThe core concept of `fillin` lies in separating the action (do what) and the environment (to where) in the command.\nWith this `fillin` command line tool, you can\n\n- make your commands reusable and it will make incremental shell history searching easy.\n- fill in the template variables interactively and their history will be stored locally.\n- invoke the same action switching multiple environment (local, staging and production servers, configuration paths, cloud service accounts or whatever)\n\n## Installation\n### Homebrew\n```sh\nbrew install itchyny/tap/fillin\n```\n\n### Build from source\n```sh\ngo install github.com/itchyny/fillin@latest\n```\n\n## Usage\nThe interface of the `fillin` command is very simple.\nPrepend `fillin` to the command and create template variables with `{{...}}`.\nSo the hello world for the `fillin` command is as follows.\n```sh\n $ fillin echo {{message}}\nmessage: Hello, world!        # you type here\nHello, world!                 # fillin executes: echo 'Hello, world!'\n```\nThe value of `message` variable is stored locally (in `~/.config/fillin/fillin.json`; you can configure the directory by `FILLIN_CONFIG_DIR`).\nYou can use the recently used value with the upwards key.\nNote that in fish shell you can use square brackets like `fillin echo [[message]]`.\n\nThe `{{message}}` (or `[[message]]` in fish shell) is a template part of the command.\nAs the identifier, you can use alphabets, numbers, underscore and hyphen.\nThus `{{sample-id}}`, `{{SAMPLE_ID}}`, `{{X01}}` and `{{FOO_example-identifier0123}}` are all valid template parts.\n\nOne of the important features of `fillin` is variable scope grouping.\nLet's look into more practical example.\nWhen you connect to a PostgreSQL server, you can use:\n```sh\n $ fillin psql -h {{psql:hostname}} -U {{psql:username}} -d {{psql:dbname}}\n[psql] hostname: localhost\n[psql] username: example-user\n[psql] dbname: example-db\n```\nWhat's the benefit of `psql:` prefix?\nYou'll notice the answer when you execute the command again:\n```sh\n $ fillin psql -h {{psql:hostname}} -U {{psql:username}} -d {{psql:dbname}}\n[psql] hostname, username, dbname: localhost, example-user, example-db   # you can select the most recently used entry with the upwards key\n```\nThe identifiers with the same scope name (`psql` scope here) can be selected as pairs.\nYou can input individual values to create a new pair after skipping the multi input prompt.\n```sh\n $ fillin psql -h {{psql:hostname}} -U {{psql:username}} -d {{psql:dbname}}\n[psql] hostname, username, dbname:             # just type enter to input values for each identifiers\n[psql] hostname: example.org\n[psql] username: example-org-user\n[psql] dbname: example-org-db\n```\n\nThe scope grouping behaviour is useful with some authorization keys.\n```sh\n $ fillin curl {{example-api:base-url}}/api/1/example/info -H 'Authorization: Bearer {{example-api:access-token}}'\n[example-api] base-url, access-token: example.com, accesstokenabcde012345\n```\nThe `base-url` and `access-token` are stored in pairs so you can easily switch between local, staging and production environment authorization.\nWithout the grouping behaviour, variable history searching will lead you to an unmatched pair of `base-url` and `access-token`.\nSince the curl endpoint are stored in the shell history and authorization keys are stored in `fillin` history, we'll not be bothered by the quadratic number of the command history.\n\nIn order to have the benefit of this grouping behaviour, it's strongly recommended to prepend the scope name.\nThe `psql:` prefix on connecting to PostgreSQL database server, `redis:` prefix for Redis server are useful best practice in my opinion.\n\n## Disclaimer\nThis tool is not an encryption tool.\nThe command saves the inputted values in a JSON file with no encryption.\nDo not use this tool for security reason.\n\n## Bug Tracker\nReport bug at [Issues・itchyny/fillin - GitHub](https://github.com/itchyny/fillin/issues).\n\n## Author\nitchyny (https://github.com/itchyny)\n\n## License\nThis software is released under the MIT License, see LICENSE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitchyny%2Ffillin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitchyny%2Ffillin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitchyny%2Ffillin/lists"}