Project

git-gsub

0.03
No release in over 3 years
Low commit activity in last 3 years
There's a lot of open issues
git-gsub: Newer version is written in Go and Ruby implementation is deprecated. See https://github.com/fujimura/git-gsub
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

>= 6.0.3.1
 Project Readme

git-gsub

A Git subcommand to do gsub in a repository

Usage

$ git gsub
Usage git gsub [options] FROM TO [PATHS]

Options:
      --snake         Substitute snake-cased expressions
      --kebab         Substitute kebab-cased expressions
      --camel         Substitute (upper) camel-cased expressions
      --upper-camel   Substitute upper-camel-cased expressions
      --lower-camel   Substitute lower-camel-cased expressions
  -a, --all           Substitute (snake|kebab|camel)-cased expressions
      --ruby          Substitute Ruby module and directory expressions
  -r, --rename        Rename files with expression
  -F, --fgrep         Interpret given pattern as a fixed string
  -v, --version       Show version

Example

Normal substutution

To substitute Git with Subversion:

$ git gsub Git Subversion

Result:

diff --git a/README.md b/README.md
index 2185dbf..393dbc6 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# Git::Gsub
+# Subversion::Gsub
 
 TODO: Write a gem description
 
diff --git a/bin/git-gsub b/bin/git-gsub
index c30f093..03b7c4c 100755
--- a/bin/git-gsub
+++ b/bin/git-gsub
@@ -1,4 +1,4 @@
 #! /usr/bin/env ruby
 
 require 'git/gsub'
-Git::Gsub.run
+Subversion::Gsub.run

Case-converting substitution

To substitute CommonLisp with VisualBasic with case-awareness:

$ git gsub --kebab --snake --camel CommonLisp VisualBasic

Result:

diff --git a/README.md b/README.md
index 2185dbf..393dbc6 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# CommonLisp common_lisp common-lisp
+# VisualBasic visual_basic visual-basic

Substitute and rename file

Substitute and rename file:

$ git gsub --rename --camel git svn

Result:

diff --git a/lib/git.rb b/lib/git.rb
deleted file mode 100644
index f0b8633..0000000
--- a/lib/git.rb
+++ /dev/null
@@ -1 +0,0 @@
-puts "GitGsub"
diff --git a/lib/svn.rb b/lib/svn.rb
new file mode 100644
index 0000000..312f137
--- /dev/null
+++ b/lib/svn.rb
@@ -0,0 +1 @@
+puts "SvnGsub"

Installation

$ go install github.com/fujimura/git-gsub@latest

Contributing

  1. Fork it ( http://github.com/fujimura/git-gsub/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request