Sha256: ccef9f2fdba91111273cb2f00f5d309cf00e599d7f372f586b74b96fee032d0d

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

#!/usr/bin/env ruby
require 'space2underscore'

CREATE_FLAGS = %w(-c --create)

args = ARGV.reject { |arg| CREATE_FLAGS.include?(arg) }
underscore_include_sentence = Space2underscore.convert(args)

result =
  if ARGV.empty?
    Space2underscore.usage
  else
    if ARGV.include?('-c') || ARGV.include?('--create')
      if Space2underscore.create_new_branch(underscore_include_sentence)
        "Switched to a new branch '#{underscore_include_sentence}'"
      else
        "fatal: A branch named '#{underscore_include_sentence}' already exists."
      end
    else
      underscore_include_sentence
    end
  end

puts result

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
space2underscore-0.3.7 bin/s2u
space2underscore-0.3.7 bin/space2underscore