๐ nsh (nameShift) Documentation
March 19, 2024 ยท View on GitHub
Overview
nsh, formerly known as nameShift, is a versatile tool designed for comprehensive string transformations across files and directories. It offers a range of functionalities tailored for renaming files, modifying file contents, and filtering operations based on file extensions. nsh supports both synchronous and concurrent processing, accommodates case-sensitive or case-agnostic operations, and provides detailed reports on modifications.
Key Features
- File and Directory Renaming: Easily rename files and directories.
- String Replacement: Perform string replacements within file contents.
- File Extension Filtering: Focus operations on files with specific extensions.
- Processing Modes: Choose between concurrent or synchronous processing.
- Case Sensitivity Options: Operate in either case-sensitive or case-agnostic mode.
- Configurable Directory Exclusion: Optionally include or exclude config directories.
- Detailed Reporting: Generate tabular reports detailing modifications and errors.
- Flexible Flag Handling: Use either short or long-form command-line flags.
๐ง Build Instructions ๐ง
Windows
- Open the command prompt.
- Navigate to the
nshroot directory containingbuild.bat. - Execute the build script:
โ
.\build.bat
Unix
- Open the terminal.
- Navigate to the
nshroot directory containingbuild.sh. - Run the build script:
โ
./build.sh
Installing nsh System-Wide
Unix Systems
- Note: Installation may require elevated privileges (
sudo). - To install, run:
โ
sudo python3 build/install.py
Or:
โ
sudo ./build/install.py
Or simply use
โ
go install
If you're Ok with just installing it inside
$GOPATH/bindirectory.
Windows
- Execute the installation script:
โ
python build\\install.py
Or directly run:
โ
build\\install
Or simply use
โ
go install
If you're Ok with just installing it inside
$GOPATH/bindirectory.
Usage Examples
Windows
โ
.\`nsh`.exe "path\\to\\directory" "OldText" "NewText" --ignore-config-dirs=true --work-globally=false --concurrent-run=false --case-matching=true --file-extensions=".go,.md"
Or, for an installed tool:
โ
`nsh` "path\\to\\directory" "OldText" "NewText" -i=true -g=false -cr=false -cm=true --exts=".go,.md"
Unix Systems
โ
./`nsh` "path/to/directory" "OldText" "NewText" --ignore-config-dirs=true --work-globally=false -concurrent-run=false -case-matching=true --file-extensions=".go,.md"
Or for an installed tool:
โ
`nsh` "path/to/directory" "OldText" "NewText" -i=true -g=false -cr=false -cm=true --ext=".go,.md"
Advanced Options and Flexibility
nsh accommodates different user preferences with dual parameter formats (verbose and shorthand) and has a forgiving approach to typos and parameter variations. Its flexibility extends to accepting both ext and exts for specifying file extensions.
Future Enhancements
- GUI Integration: Bringing the power of
nshto a graphical user interface. - Cross-Platform Package Managers: Aim to distribute
nshthrough package managers like Homebrew, apt, and others, making installation a breeze. - Advanced Pattern Matching: Implement regex support for the adventurers who need to capture or transform more complex string patterns.
- Localization Support: Support multiple languages.
- Plugin Ecosystem: Enabling the community to extend
nshwith their own plugins. - FFI Function Exposure: Enabling the community to use
nshoutside of the go realm.