https://github.com/sinedied/ntk-tagger
a python script to search & replace text tags in source files
https://github.com/sinedied/ntk-tagger
Last synced: about 2 months ago
JSON representation
a python script to search & replace text tags in source files
- Host: GitHub
- URL: https://github.com/sinedied/ntk-tagger
- Owner: sinedied
- License: mit
- Created: 2013-09-11T08:32:46.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-30T12:17:12.000Z (almost 10 years ago)
- Last Synced: 2025-08-12T05:53:45.228Z (about 2 months ago)
- Language: Python
- Size: 137 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NTK/Tagger - Search & replace text tags in source files
It is part of the NTK project and aims to ease the process of tagging source
files with specific information like license or version information.A source file tag have the form: @@tag_name@@
It can also performs in-file deletions and replacements using python regular
expressions.For more information about python regular expressions, please refer to:
http://docs.python.org/library/re.htmlThe text processing is done in the following order:
REGEX DELETE > REGEX REPLACE > TAG REPLACE > TAG FILE REPLACE
## Limitations
The '.' (dot) character matches any character, including newline, to allow
multiline search & replace.## Requirements
Python v.2.7.0 or higher is required.
## Usage
tagger.py [-h] [-r EXPR_TO_REMOVE] [-e EXPR_TO_REPLACE STRING]
[-t TAG_TO_REPLACE STRING] [-f TAG_TO_REPLACE PATH]
[-o OUTPUT_FILE] [-R]
input_fileRequired arguments:
* input_file the input file or folder to manipulate
Optional arguments:
* `-r EXPR_TO_REMOVE, --remove_expr EXPR_TO_REMOVE`
a python regex for content to remove in the file* `-e EXPR_TO_REPLACE STRING, --replace_expr EXPR_TO_REPLACE STRING`
a python regex for content to replace by the followed
string in the file* `-t TAG_TO_REPLACE STRING, --replace_tag TAG_TO_REPLACE STRING`
a tag to replace by the followed string in the file
* `-f TAG_TO_REPLACE PATH, --replace_tag_file TAG_TO_REPLACE STRING`
a tag to replace by the content at the followed path
in the file
* `-o OUTPUT_FILE, --output_file OUTPUT_FILE`
create a new file to output the modifications (by
default the modifications are done in-place), has no
effect if the target is a folder
* `-R, --recursive` if the specified input file is a folder, recurse
through all subfolders