{"id":21997644,"url":"https://github.com/osfunapps/os-xml-automation-py","last_synced_at":"2025-03-23T04:45:08.162Z","repository":{"id":57449796,"uuid":"307074228","full_name":"osfunapps/os-xml-automation-py","owner":"osfunapps","description":"this module contains automation tools for py file handling ","archived":false,"fork":false,"pushed_at":"2021-02-07T14:12:07.000Z","size":171,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T19:55:01.165Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","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/osfunapps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-25T10:29:57.000Z","updated_at":"2021-02-07T14:12:11.000Z","dependencies_parsed_at":"2022-09-26T17:31:10.858Z","dependency_job_id":null,"html_url":"https://github.com/osfunapps/os-xml-automation-py","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/osfunapps%2Fos-xml-automation-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos-xml-automation-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos-xml-automation-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osfunapps%2Fos-xml-automation-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osfunapps","download_url":"https://codeload.github.com/osfunapps/os-xml-automation-py/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056902,"owners_count":20553854,"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":[],"created_at":"2024-11-29T22:17:33.762Z","updated_at":"2025-03-23T04:45:08.144Z","avatar_url":"https://github.com/osfunapps.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n------------\n\nThis module contains automation tools for files and text handling\n\n## Installation\nInstall via pip:\n\n    pip install os-xml-automation\n\n## File handling automation:\n   \nWill copy/delete directories/files defined by a xml map file.\n\n- [xml example](/examples/file_mapper/example.xml):\n\n```xml\n\u003croot\u003e\n\n     \u003c!--example 1 --\u003e\n     \u003c!--the tag name of the files/dirs can be whatever you want --\u003e\n    \u003cdir_copy_1 action=\"copy\"\u003e\n\n        \u003cdir_src\u003e\n            \u003cpath \u003e./same_dir_file.txt\u003c/path\u003e\n        \u003c/dir_src\u003e\n\n        \u003cdir_dst\u003e\n            \u003cpath\u003e../copied_file.txt\u003c/path\u003e\n        \u003c/dir_dst\u003e\n\n    \u003c/dir_copy_1\u003e\n\n\n    \u003c!-- example 2 --\u003e\n    \u003c!-- the tag name of the files/dirs can be whatever you want --\u003e\n    \u003cdir_copy_2 action=\"copy\"\u003e\n\n        \u003c!-- set path_type as \"search\" to look for the dir in a given path --\u003e\n        \u003cdir_src path_type=\"search\"\u003e\n            \u003csearch_path\u003e/a/path/to/search/for/the/dir\u003c/search_path\u003e\n            \u003cfull_name\u003emy_dir_name\u003c/full_name\u003e\n        \u003c/dir_src\u003e\n\n        \u003cdir_dst\u003e\n            \u003cpath\u003e../my_dir_name_copy\u003c/path\u003e\n        \u003c/dir_dst\u003e\n    \u003c/dir_copy_2\u003e\n\n\n    \u003c!-- example 3 --\u003e\n    \u003c!-- the tag name of the files/dirs can be whatever you want --\u003e\n    \u003cfile_copy_1 action=\"copy\"\u003e\n\n        \u003c!-- set path_type as \"search\" to look for the file in a given path --\u003e\n        \u003cfile_src path_type=\"search\"\u003e\n\n\n            \u003c!-- here we will use a place holder defined when you'll call the function--\u003e\n            \u003csearch_path\u003e$a_path_defined_in_code\u003c/search_path\u003e\n            \u003cname_prefix\u003emyf\u003c/name_prefix\u003e\n            \u003c!--\u003cname_suffix\u003eile\u003c/name_suffix\u003e--\u003e\n            \u003cextension\u003e.txt\u003c/extension\u003e\n        \u003c/file_src\u003e\n\n        \u003cfile_dst\u003e\n            \u003cpath\u003e../copied_file.txt\u003c/path\u003e\n        \u003c/file_dst\u003e\n    \u003c/file_copy_1\u003e\n\n    \u003c!-- example 4 --\u003e\n    \u003c!-- the tag name of the files/dirs can be whatever you want --\u003e\n    \u003cfile_copy_2 action=\"copy\"\u003e\n\n        \u003c!-- set path_type as \"search\" to look for the file in a given path --\u003e\n        \u003cfile_src\u003e\n            \u003cpath\u003epath/to/my/file.txt\u003c/path\u003e\n        \u003c/file_src\u003e\n\n        \u003cfile_dst\u003e\n            \u003cpath\u003epath/to/my/file_2.txt\u003c/path\u003e\n        \u003c/file_dst\u003e\n    \u003c/file_copy_2\u003e\n\n\n    \u003c!-- delete file example --\u003e    \n    \u003cfile_delete_1 action=\"delete\"\u003e\n\n        \u003c!-- set path_type as \"search\" to look for the file in a given path --\u003e\n        \u003cfile_src path_type=\"search\"\u003e\n            \u003c!-- here we will use a place holder defined when you'll call the function--\u003e\n            \u003csearch_path\u003e/Users/home/Desktop/bv/temp\u003c/search_path\u003e\n            \u003cprefix\u003etoc\u003c/prefix\u003e\n        \u003c/file_src\u003e\n    \u003c/file_delete_1\u003e\n\n\n\u003c/root\u003e\n```\nAfter your created the xml file, call it from code:\n```python    \nfrom os_xml_automation import xml_automation as xm\n\nxm.manipulate_files_by_xml(xml_path='path/to/xml', place_holder_map= {'$project_path': 'the/path/to/my/project/path'})\n```\n## Text automation\n\nWill copy/append/replace/delete text defined by a xml map file.\n\n- [xml example](/examples/text_mapper/example.xml):\n```xml\n\u003croot\u003e\n    \n    \u003c!-- example 1 --\u003e\n    \u003c!-- the tag name of the files can be whatever you want --\u003e\n    \u003cfaces_file\u003e\n\n        \u003c!-- set path_type as \"search\" to look for the file in a given path --\u003e\n        \u003cfile_src path_type=\"search\"\u003e\n            \u003csearch_path\u003e../search_path\u003c/search_path\u003e\n            \u003cfull_name\u003efaces_file.java\u003c/full_name\u003e\n            \u003c!-- other search tags could be:\n            \u003cname_prefix\u003emy_fi\u003c/name_prefix\u003e\n            \u003cname_suffix\u003e_file\u003c/name_suffix\u003e\n            \u003cextension\u003e.java\u003c/extension\u003e\n            --\u003e\n        \u003c/file_src\u003e\n\n        \u003c!-- set path_type as \"as_src\" to overwrite the source file. in this example, my_file.java --\u003e\n        \u003cfile_dst path_type=\"as_src\" /\u003e\n        \u003ctexts\u003e\n            \u003ctext action=\"delete_line\"\u003e\n                \u003coriginal_text\u003ethis is a sad face: 😥\u003c/original_text\u003e\n            \u003c/text\u003e\n            \u003ctext action=\"replace_line\"\u003e\n                \u003coriginal_text\u003ethis is a spooked face: 😱\u003c/original_text\u003e\n                \u003cnew_text\u003ethis line will be instead of the spooky face\u003c/new_text\u003e\n            \u003c/text\u003e\n            \u003ctext action=\"above_line\"\u003e\n                \u003coriginal_text\u003ethis is a funny face: 👾\u003c/original_text\u003e\n                \u003cnew_text\u003ethis line will be above the funny face\u003c/new_text\u003e\n            \u003c/text\u003e\n\n            \u003c!-- delete_range will remove text between boundaries --\u003e\n            \u003ctext action=\"delete_range\" include_boundaries=\"true\"\u003e\n                \u003cfrom_text\u003erange delete start\u003c/from_text\u003e\n                \u003cto_text\u003erange delete end\u003c/to_text\u003e\n            \u003c/text\u003e\n\n            \u003c!-- set_in_range will remove the text in a range and set a new text instead --\u003e\n            \u003ctext action=\"set_in_range\"\u003e\n                \u003cfrom_text\u003erange delete start\u003c/from_text\u003e\n                \u003cto_text\u003erange delete end\u003c/to_text\u003e\n                \u003cnew_text\u003ethis text is inside the range 🔥🔥\u003c/new_text\u003e\n            \u003c/text\u003e\n\n        \u003c/texts\u003e\n    \u003c/faces_file\u003e\n\n\n    \u003c!-- example 2 --\u003e\n    \u003c!-- the tag name of the files can be whatever you want --\u003e\n    \u003cpeople_file\u003e\n        \u003cfile_src path_type=\"search\"\u003e\n\n            \u003c!-- this example shows the use of place holders. The place holders values could be defined via code and replace the place holders in the xml, during runtime.\n            in this example $project_path could be defined during runtime to be whatever path you want (even relative) --\u003e\n            \u003csearch_path\u003e$project_path\u003c/search_path\u003e\n            \u003cfull_name\u003epeople_names.swift\u003c/full_name\u003e\n        \u003c/file_src\u003e\n        \u003cfile_dst path_type=\"as_src\" /\u003e\n        \u003ctexts\u003e\n            \u003ctext action=\"replace\"\u003e\n                \u003c!-- place holders can be used wherever you want. Event in the text you look for! --\u003e\n                \u003coriginal_text\u003e$first_person_name\u003c/original_text\u003e\n                \u003cnew_text\u003eJohnny the tool 😼\u003c/new_text\u003e\n            \u003c/text\u003e\n            \u003ctext action=\"below_line\"\u003e\n                \u003coriginal_text\u003ecraig the $craig_last_name\u003c/original_text\u003e\n                \u003cnew_text\u003eOsama bin gladden 👳 is below craig $craig_last_name\u003c/new_text\u003e\n            \u003c/text\u003e\n        \u003c/texts\u003e\n    \u003c/people_file\u003e\n\n    \u003c!-- example 3 --\u003e\n    \u003cbounderies_file\u003e\n        \u003cfile_src path_type=\"search\"\u003e\n\n            \u003c!-- this example shows the use of place holders. The place holders values could be defined via code and replace the place holders in the xml, during runtime.\n            in this example $project_path could be defined during runtime to be whatever path you want (even relative) --\u003e\n            \u003csearch_path\u003e$project_path\u003c/search_path\u003e\n            \u003cfull_name\u003epeople_names.swift\u003c/full_name\u003e\n        \u003c/file_src\u003e\n        \u003cfile_dst path_type=\"as_src\" /\u003e\n        \u003ctexts\u003e\n            \u003ctext action=\"replace\"\u003e\n                \u003c!-- place holders can be used wherever you want. Event in the text you look for! --\u003e\n                \u003coriginal_text\u003e$first_person_name\u003c/original_text\u003e\n                \u003cnew_text\u003eJohnny the tool 😼\u003c/new_text\u003e\n            \u003c/text\u003e\n            \u003ctext action=\"below_line\"\u003e\n                \u003coriginal_text\u003ecraig the $craig_last_name\u003c/original_text\u003e\n                \u003cnew_text\u003eOsama bin gladden 👳 is below craig $craig_last_name\u003c/new_text\u003e\n            \u003c/text\u003e\n        \u003c/texts\u003e\n    \u003c/bounderies_file\u003e\n\n\u003c/root\u003e\n```\nNOTICE: It doesn't matter what the tag names of the file nodes (the direct children of the root). \n    \nTo use:\n```python\nfrom os_xml_automation import xml_automation as xm\n \nxm.set_texts_by_xml(xml_path='path/to/xml',\n                    place_holder_map={'$project_path': 'the/path/to/my/project/path',\n                                        '$first_person_name': 'Johnny boy',\n                                       '$second_person_name': 'Craig and Josh'})\n```\nAnd more...\n\n\n## Links\n[GitHub - osapps](https://github.com/osfunapps)\n\n## Licence\nISC","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fos-xml-automation-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosfunapps%2Fos-xml-automation-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosfunapps%2Fos-xml-automation-py/lists"}