Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/osfunapps/os-xml-automation-py

this module contains automation tools for py file handling
https://github.com/osfunapps/os-xml-automation-py

Last synced: 27 days ago
JSON representation

this module contains automation tools for py file handling

Awesome Lists containing this project

README

        

Introduction
------------

This module contains automation tools for files and text handling

## Installation
Install via pip:

pip install os-xml-automation

## File handling automation:

Will copy/delete directories/files defined by a xml map file.

- [xml example](/examples/file_mapper/example.xml):

```xml




./same_dir_file.txt


../copied_file.txt





/a/path/to/search/for/the/dir
my_dir_name


../my_dir_name_copy





$a_path_defined_in_code
myf

.txt


../copied_file.txt





path/to/my/file.txt


path/to/my/file_2.txt





/Users/home/Desktop/bv/temp
toc

```
After your created the xml file, call it from code:
```python
from os_xml_automation import xml_automation as xm

xm.manipulate_files_by_xml(xml_path='path/to/xml', place_holder_map= {'$project_path': 'the/path/to/my/project/path'})
```
## Text automation

Will copy/append/replace/delete text defined by a xml map file.

- [xml example](/examples/text_mapper/example.xml):
```xml






../search_path
faces_file.java





this is a sad face: 😥


this is a spooked face: 😱
this line will be instead of the spooky face


this is a funny face: 👾
this line will be above the funny face



range delete start
range delete end



range delete start
range delete end
this text is inside the range 🔥🔥






$project_path
people_names.swift





$first_person_name
Johnny the tool 😼


craig the $craig_last_name
Osama bin gladden 👳 is below craig $craig_last_name





$project_path
people_names.swift





$first_person_name
Johnny the tool 😼


craig the $craig_last_name
Osama bin gladden 👳 is below craig $craig_last_name


```
NOTICE: It doesn't matter what the tag names of the file nodes (the direct children of the root).

To use:
```python
from os_xml_automation import xml_automation as xm

xm.set_texts_by_xml(xml_path='path/to/xml',
place_holder_map={'$project_path': 'the/path/to/my/project/path',
'$first_person_name': 'Johnny boy',
'$second_person_name': 'Craig and Josh'})
```
And more...

## Links
[GitHub - osapps](https://github.com/osfunapps)

## Licence
ISC