Sha256: f2952b952af45bcb3e5ba2a3b99c2e36bbc50209eb13209bb8f9dbc4589ffa95

Contents?: true

Size: 644 Bytes

Versions: 4

Compression:

Stored size: 644 Bytes

Contents

#!/usr/bin/env ruby
# coding: utf-8

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

4 entries across 2 versions & 1 rubygems

Version Path
space2underscore-0.3.9 bin/s2u
space2underscore-0.3.9 bin/space2underscore
space2underscore-0.3.8 bin/s2u
space2underscore-0.3.8 bin/space2underscore