https://github.com/onlyuser/sh
sh is a collection of handy shell scripts
https://github.com/onlyuser/sh
bash-script
Last synced: 4 months ago
JSON representation
sh is a collection of handy shell scripts
- Host: GitHub
- URL: https://github.com/onlyuser/sh
- Owner: onlyuser
- Created: 2012-06-02T00:55:23.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2018-12-27T16:21:33.000Z (about 7 years ago)
- Last Synced: 2025-10-14T00:03:39.054Z (4 months ago)
- Topics: bash-script
- Language: Shell
- Homepage: http://onlyuser.github.io/
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
sh
==
Copyright (C) 2011-2017
About:
------
sh is a collection of handy shell scripts.
**Currently, it includes the following:**
* xgrep -- a grep wrapper that screens filenames before grepping
* xrefact -- a script for refactoring code
* xform -- a script for applying my coding conventions
* diff.py -- a meld wrapper for better git diff experience
xgrep:
------
- Synopsis:
- xgrep <FILENAME> [SEARCH_STR]
- Description:
- Searches for SEARCH_STR in files matched by FILENAME.
- If SEARCH_STR not given, simply lists files matched by FILENAME.
**Parameters:**
* FILENAME -- regex describing which files to apply action
* SEARCH_STR -- grepped regex to apply to files matched
xrefact:
--------
- Synopsis:
- xrefact <FILENAME> <SEARCH_STR> <REPLACE_STR> [IGNORE_COLLISION={1/0}]
- Description:
- Replaces SEARCH_STR with REPLACE_STR for files matched by FILENAME.
- If IGNORE_COLLISION is 0, skips replaces that produce new occurrences of SEARCH_STR.
- Replaces files named SEARCH_STR to REPLACE_STR as well.
- IGNORE_COLLISION also applies to file renaming, with analogous functionality.
**Parameters:**
* FILENAME -- regex describing which files to apply action
* SEARCH_STR -- grepped regex to apply to files matched
* REPLACE_STR -- string to replace SEARCH_STR
* IGNORE_COLLISION -- 1 for force replace, 0 for skipping collision case
xform:
------
- Synopsis:
- xform <FILENAME>
- Description:
- Applies formatting rules to files matched by FILENAME.
**Parameters:**
* FILENAME -- regex describing which files to apply action
**Format rules:**
* unify indent
* trim trailing space
* unify empty brace spacing
* unify control-statement spacing
* unify spacing after "#include" and "namespace"
* STL headers (remove file extension + replace quotes with angle braces)
* C++ headers (remove file extension + replace quotes with angle braces)
* C headers (replace quotes with angle braces)
Requirements:
-------------
Add these lines to your .bashrc to gain PATH access (to my scripts):
export PATH=sh:$PATH
export PATH=sh/xargs:$PATH
Add these lines to your .bashrc to use diff.py:
#git config --global diff.external meld
git config --global diff.external sh/diff.py
Keywords:
---------
shell scripting, bash, git, meld