Sha256: 7de1cb5a9f99383b862e441d9ed5653f2a2e14066c5b955eaffe3816a78fee1d

Contents?: true

Size: 814 Bytes

Versions: 4

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

require 'space2underscore/version'

# This is the main functions.
module Space2underscore
  MESSAGE = <<-EOF.chomp
      NAME:
         space2underscore - Change the space into underscore

      USAGE:
         $ space2underscore new branch -c
         =>  Switched to the new branch 'new_branch’

        Or

        $ git branch -m $(space2underscore renamed branch)

      VERSION:
         #{Space2underscore::VERSION}

      OPTIONS:
         --create, -c         create a new branch
  EOF

  def self.convert(argv)
    argv.length == 1 ? argv[0].strip.gsub(/\s/, '_') : argv.join('_')
  end

  def self.create_new_branch(underscore_include_sentence)
    system "git checkout -b #{underscore_include_sentence}"
  end

  def self.usage
    MESSAGE.gsub('      ', '')
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
space2underscore-0.5.1 lib/space2underscore.rb
space2underscore-0.5.0 lib/space2underscore.rb
space2underscore-0.4.3 lib/space2underscore.rb
space2underscore-0.4.2 lib/space2underscore.rb