{"id":19714772,"url":"https://github.com/cainky/replacetext","last_synced_at":"2025-02-27T16:41:50.761Z","repository":{"id":251965855,"uuid":"838944277","full_name":"cainky/ReplaceText","owner":"cainky","description":"Replaces text based on a dictionary, given user input to specify which direction (keys-to-values or values-to-keys)","archived":false,"fork":false,"pushed_at":"2024-12-23T17:29:45.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T15:14:37.728Z","etag":null,"topics":["batch-processing","python","text-processing","text-replacement","utility"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cainky.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":"2024-08-06T16:43:09.000Z","updated_at":"2024-12-23T17:29:48.000Z","dependencies_parsed_at":"2024-08-06T22:29:15.939Z","dependency_job_id":null,"html_url":"https://github.com/cainky/ReplaceText","commit_stats":null,"previous_names":["cainky/replacetext"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2FReplaceText","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2FReplaceText/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2FReplaceText/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cainky%2FReplaceText/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cainky","download_url":"https://codeload.github.com/cainky/ReplaceText/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241035899,"owners_count":19898085,"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":["batch-processing","python","text-processing","text-replacement","utility"],"created_at":"2024-11-11T22:35:42.899Z","updated_at":"2025-02-27T16:41:50.728Z","avatar_url":"https://github.com/cainky.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ReplaceText\n\nThis project replaces text in files based on a dictionary, given user input to specify which direction (keys-to-values or values-to-keys).\n\n## Features\n\n- Replace text in files based on dictionaries defined in a configuration file.\n- Allows user to specify the direction of replacement (keys-to-values or values-to-keys).\n- Allows user to specify which file extensions, file prefixes, or directories to ignore.\n- Automatically uses the only dictionary if only one is defined in the configuration file.\n\n## Requirements\n\n- Python 3.8 or higher\n- Poetry package manager\n\n## Installation\n\n1. **Install Poetry** (if not already installed):\n\n    ```sh\n    curl -sSL https://install.python-poetry.org | python3 -\n    ```\n\n2. **Clone the repository and navigate to the project directory**:\n\n    ```sh\n    git clone https://github.com/cainky/ReplaceText.git\n    cd ReplaceText\n    ```\n\n3. **Install dependencies**:\n\n    ```sh\n    poetry install\n    ```\n\n## Configuration\n\n1. **Rename the example configuration file**:\n\n    ```sh\n    mv example_config.json config.json\n    ```\n\n2. **Edit `config.json` to define your dictionaries**. Here is an example\n\n    ```json\n    {\n      \"dictionaries\": {\n        \"example1\": {\n          \"key1\": \"value1\",\n          \"key2\": \"value2\",\n          \"key3\": \"value3\"\n        },\n        \"example2\": {\n          \"hello\": \"world\",\n          \"foo\": \"bar\",\n          \"python\": \"rocks\"\n        }\n      },\n    \"ignore_extensions\": [\".exe\", \".dll\", \".bin\"],\n    \"ignore_directories\": [\"node_modules\", \"venv\", \".git\"],\n    \"ignore_file_prefixes\": [\".\", \"_\"]\n    }\n    ```\n\n## Usage\n\nRun the script using Poetry:\n\n```sh\npoetry run python replace_text/replace_text.py\n```\n\nThe script will prompt you for the following inputs:\n\nDirection of replacement:\n\n- Enter '1' for keys-to-values\n- Enter '2' for values-to-keys\n\nFolder path:\n\n- Enter the path to the folder containing the files to be processed.\n\nDictionary name:\n\n- Enter the name of the dictionary to use from config.json.\nThe script will process all files in the specified folder, replacing text based on the selected dictionary and direction.\n\n## License\nReplaceText is distributed under the [GNU General Public License, Version 3](./LICENSE), allowing for free software distribution and modification while ensuring that all copies and modified versions remain free.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainky%2Freplacetext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcainky%2Freplacetext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcainky%2Freplacetext/lists"}