{"id":18643353,"url":"https://github.com/k4j8/filetailor","last_synced_at":"2025-04-11T11:31:56.582Z","repository":{"id":43864667,"uuid":"427840297","full_name":"k4j8/filetailor","owner":"k4j8","description":"Copy and modify plain text files between devices without templates or symlinks","archived":false,"fork":false,"pushed_at":"2024-06-09T15:47:47.000Z","size":1397,"stargazers_count":12,"open_issues_count":8,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-06T13:06:16.142Z","etag":null,"topics":["chezmoi","configuration-management","dotbot","dotfiles","git","gnustow","python","stow","yaml"],"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/k4j8.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":"2021-11-14T04:52:11.000Z","updated_at":"2025-04-05T01:39:37.000Z","dependencies_parsed_at":"2024-05-30T16:01:24.979Z","dependency_job_id":"fab7d261-f4e5-4e70-97b7-ac2224e11c7f","html_url":"https://github.com/k4j8/filetailor","commit_stats":{"total_commits":39,"total_committers":2,"mean_commits":19.5,"dds":0.02564102564102566,"last_synced_commit":"27ee076e75d33c1abb63a38751d50c0f87c30ff2"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4j8%2Ffiletailor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4j8%2Ffiletailor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4j8%2Ffiletailor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/k4j8%2Ffiletailor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/k4j8","download_url":"https://codeload.github.com/k4j8/filetailor/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384012,"owners_count":21094657,"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":["chezmoi","configuration-management","dotbot","dotfiles","git","gnustow","python","stow","yaml"],"created_at":"2024-11-07T06:06:33.774Z","updated_at":"2025-04-11T11:31:55.636Z","avatar_url":"https://github.com/k4j8.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# filetailor\n\n**Update:** I have since discovered [Chezmoi](https://www.chezmoi.io/), which has many of the same features as filetailor and is much more mature. I recommend using Chezmoi instead. However, Chezmoi does rely on templates, unlike filetailor.\n\nfiletailor is a peer-based configuration management utility for plain-text files (and directories) such as dotfiles. Files are backed up to a specified folder using filetailor, copied to another device using tools such as [Nextcloud](https://nextcloud.com/), [Syncthing](https://syncthing.net/), or [Git](https://git-scm.com/), and then copied to other devices using filetailor again. No symbolic links are used in the process.\n\nDuring the backup and restore process, filetailor can modify the file contents and path for the specific device according to variables and line-specific controls defined in YAML _without_ the use of templates. See [list of features](https://github.com/k4j8/filetailor/wiki/Features).\n\n![flowchart](docs/flowchart.png)\n\n\u003c!-- START doctoc generated TOC please keep comment here to allow auto update --\u003e\n\u003c!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --\u003e\n**Table of Contents**  *generated with [DocToc](https://github.com/thlorenz/doctoc)*\n\n- [Example Usage](#example-usage)\n- [Getting Started](#getting-started)\n  - [Installation](#installation)\n  - [Configuration](#configuration)\n  - [Usage](#usage)\n- [Line-Specific Control](#line-specific-control)\n    - [Example: single-line control](#example-single-line-control)\n- [Diff Programs](#diff-programs)\n- [More Help](#more-help)\n- [Contributing](#contributing)\n\n\u003c!-- END doctoc generated TOC please keep comment here to allow auto update --\u003e\n\n## Example Usage\n\nHere's how to sync a file to use `dev1home` on \"device1\" and `dev2home` on \"device2\" for the alias `MYHOME`.\n\n**.bashrc** on \"device1\":\n\n```bash\nalias MYHOME='/home/dev1home/' #{filetailor device1}\n# alias MYHOME='/home/dev2home/' #{filetailor device2}\n```\n```bash\n[user@device1 ~]$ filetailor add .bashrc\n[user@device1 ~]$ filetailor backup\n```\n\nDuring backup from \"device1\" to the sync folder, the first line gets commented out because the tag matches the device name. Sync the sync folder with the backed-up version of the file using your preferred method of choice to \"device2\" then restore with filetailor. During restore on \"device2\", the second line gets uncommented (again, because the tag matches the device name).\n```bash\n[user@device2 ~]$ filetailor restore\n```\n\n**.bashrc** on \"device2\":\n\n```bash\n# alias MYHOME='/home/dev1home/' #{filetailor device1}\nalias MYHOME='/home/dev2home/' #{filetailor device2}\n```\n\n## Getting Started\n\n### Installation\n\nfiletailor requires Python 3.6+ and pip. Install by running the following commands:\n```bash\n$ pip install filetailor\n\n$ filetailor init\n# Update the newly created \"filetailor.ini\" with your desired locations for synced files and configuration YAML\n\n$ filetailor init\n# Accept confirmations to create directories\n```\n\nTo sync filetailor between devices, sync the `sync_dir` and `yaml_dir` folders created in the above steps using Git, Syncthing, etc.\n\nSee [Alternative Installs](https://github.com/k4j8/filetailor/wiki/Alternative-Installs) for other installation methods.\n\n### Configuration\n\n`filetailor.yaml` (\"the YAML\") controls which files sync to which devices.\n\nYou can add/remove files to and from the YAML by running `filetailor add PATHS` and `filetailor remove PATHS` (local paths are okay). Alternatively, you can update the YAML manually by following the comments within.\n\nThe YAML also defines variables, which are strings to replace when restoring to a specific device, such as a path to a file that differs between devices. See the [FAQ](https://github.com/k4j8/filetailor/wiki/FAQ) in the wiki for examples.\n\n### Usage\n\nTo backup all files defined in the YAML from the local device to the sync folder, run `filetailor backup`. Lines/blocks matching the device name will be commented out as they are copied to the sync folder.\n\nTo restore all files defined in the YAML from the sync folder to the local device, run `filetailor restore`. Lines/blocks matching the device name will be uncommented as they are copied to the local device.\n\nTo list all available commands, run `filetailor --help`. For command details, run `filetailor COMMAND --help`.\n\n## Line-Specific Control\n\nYou can control the contents of individual files by device with line-specific controls such as the [Example Usage](https://github.com/k4j8/filetailor#example-usage) above. There are two types of line-specific controls: single-line and multi-line.\n\nTo use a single-line control, append a tag to the line you want to be commented out on other devices. During backup, any lines tagged for the current device will be commented out. During restore, lines tagged for the current device will be uncommented. Single-line control tag format:\n\u003cpre\u003e\u003ccode class=\"text\"\u003e(Code being controlled) \u003ci\u003eCOMMENT_SYM\u003c/i\u003e\u003cb\u003e{filetailor\u003c/b\u003e \u003ci\u003eDEVICES\u003c/i\u003e...\u003cb\u003e}\u003c/b\u003e\u003c/code\u003e\u003c/pre\u003e\n`COMMENT_SYM` is any symbol(s) used for comments and must be preceded by at least one space.\n\nTo control a block of lines, see [Multi-line Controls](https://github.com/k4j8/filetailor/wiki/Multi-Line-Controls).\n\n#### Example: single-line control\n\nHow the code should be written on \"desktop\":\n```bash\nexport $device_type=\"desktop\" #{filetailor desktop}\n# export $device_type=\"laptop\" #{filetailor laptop1 laptop2}\n```\n\nAfter backing up the file through filetailor and then restoring to \"laptop1\" or \"laptop2\", the code would appear like this:\n```bash\n# export $device_type=\"desktop\" #{filetailor desktop}\nexport $device_type=\"laptop\" #{filetailor laptop1 laptop2}\n```\n\nHow the code would look on any other device and in the filetailor sync folder:\n```bash\n# export $device_type=\"desktop\" #{filetailor desktop}\n# export $device_type=\"laptop\" #{filetailor laptop1 laptop2}\n```\n\n## Diff Programs\n\nBefore backing up or restoring files, filetailor will show a diff of the changes. To set the diff programs for filetailor, add the following option to `filetailor.ini`.\n```ini\n[TOOLS]\ndiff_pager = YOUR_FAVORITE_DIFF_PROGRAM  # for viewing diff in terminal\ndifftool = YOUR_FAVORITE_DIFFTOOL  # for making edits during diff in external tool\n```\n\nIf `diff_pager` is not set, filetailor will use `core.pager` (from Git config, [git-config docs](https://git-scm.com/docs/git-config)) if defined, otherwise uses `diff`.\nIf `difftool` is not set, filetailor will use `diff.tool` (from Git config, [git-difftool docs](https://git-scm.com/docs/git-difftool)) if defined, otherwise uses `diff`.\n\nOne popular supported diff pager is [Delta](https://github.com/dandavison/delta#installation). To install, follow the installation instructions in the link.\n\nRun the following command to set Delta as your [default pager for Git](https://www.git-scm.com/book/en/v2/Customizing-Git-Git-Configuration) (and thus filetailor):\n```bash\n$ git config --global core.pager delta\n```\n\n## More Help\n\nSee [FAQ](https://github.com/k4j8/filetailor/wiki/FAQ) in the wiki for more help and examples.\n\nLinks:\n- [GitHub](https://github.com/k4j8/filetailor)\n- [PyPI](https://pypi.org/project/filetailor/)\n- [AlternativeTo](https://alternativeto.net/software/filetailor/about/)\n\n## Contributing\n\nFeedback is welcome! Ways to contribute include:\n- Report a bug\n- Recommendations on new features\n- Suggestions to improve documentation and print statement readability\n\nPull requests are welcome as well, but please open an issue first describing the change. When submitting PRs, please try to conform to the following style guides:\n- Python code style: [PEP8](https://www.python.org/dev/peps/pep-0008/)\n- Man page formatting: [man-pages(7)](https://man7.org/linux/man-pages/man7/man-pages.7.html)\n- Commit message formatting: [How to Write a Git Commit Message](https://chris.beams.io/posts/git-commit/)\n- Packaging: [Python Packaging User Guide](https://packaging.python.org/)\n- Release versioning: [Semantic Versioning](https://semver.org/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4j8%2Ffiletailor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk4j8%2Ffiletailor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk4j8%2Ffiletailor/lists"}