Metadata-Version: 2.1
Name: deployment-tools
Version: 0.1.0
Summary: Simple to use command running tools and file transformation/move tools.
Author: Daniel Nikolaev
Author-email: toolsproed@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: pyyaml (>=6.0,<7.0)
Requires-Dist: toml (>=0.10.2,<0.11.0)
Description-Content-Type: text/markdown

# DEPLOYMENT-TOOLS
### Description:
Small package simplifying deployment scripts by:
* easy shell command running, with or without success checks;
* easy file editing (such as configs, settings, text, etc ...);
* easy file transfers, directory manipulation, and file reading;
### Content:
#### class Command => runs shell command from as list[str], example ["ls", "-la"]
* raise_on_failure() => raises ShellCommand exception on cmd failure;
* set_success(check:[str], on_line[int] = None) => check if string is present in outputs, could be specified specific line, where it should be (normal python indexing applies);
* set_failure(check:[str], on_line[int] = None) => check stderr for string, could be specified specific line, where it should be (normal python indexing applies);
#### class [File]Builder:
* invoked by create_file_builder(path: str, type_: str | None = None, blanked=False) => path - location of the file, type_ - if None, the function will decide based on extension, otherwise supported are json, toml, yaml/yml, or it will default to txt; blanked - will void the data in the file;
* attribute self.base_data, holds all the file information;
* [+]/[-] operand can be used to either add or remove from the files (including nesting of dicts in cases of nested configs);
* txt files support self.replace_line(patten, new_line) if pattern in existing line, it will be replaced by new_line;
* self.replace_string_in_lines(old, new), it will replace old:str with new:str in all occurances in the files;
#### class WorkingDirectory (singleton):
* slicing: [file_name] -> returns file content as dict(json, yml/yaml, toml) or list;
* setting: [file_name] = payload: str|list -> create file with provided data;
* [+]/[/]/[self.go_to(path)] - operands are used to transfer exectusion to another location;
* self.back() - return to previous location;
* self.go_to_home() - return to initial location;
* self.transfer_with_files(*args) => move execution to a location with all files in current location;
* self.transfer_and_copy_files(*args) => move execution to a location copy all files in current location;
