lib/hub/commands.rb
def alias(args)
      shells = {
        'sh'   => 'alias git=hub',
        'bash' => 'alias git=hub',
        'zsh'  => 'function git(){hub "$@"}',
        'csh'  => 'alias git hub',
        'fish' => 'alias git hub'
      }

      silent = args.delete('-s')

      if shell = args[1]
        if silent.nil?
          puts "Run this in your shell to start using `hub` as `git`:"
          print "  "
        end
      else
        puts "usage: hub alias [-s] SHELL", ""
        puts "You already have hub installed and available in your PATH,"
        puts "but to get the full experience you'll want to alias it to"
        puts "`git`.", ""
        puts "To see how to accomplish this for your shell, run the alias"
        puts "command again with the name of your shell.", ""
        puts "Known shells:"
        shells.map { |key, _| key }.sort.each do |key|
          puts "  " + key
        end
        puts "", "Options:"
        puts "  -s   Silent. Useful when using the output with eval, e.g."
        puts "       $ eval `hub alias -s bash`"

        exit
      end

      if shells[shell]
        puts shells[shell]
      else
        abort "fatal: never heard of `#{shell}'"
      end

      exit
    end
# We are a blank slate.
We are a blank slate.
We are a blank slate .
def alias(args)
      shells = {
        'sh'   => 'alias git=hub',
        'bash' => 'alias git=hub',
        'zsh'  => 'function git(){hub "$@"}',
        'csh'  => 'alias git hub',
        'fish' => 'alias git hub'
      }
      silent = args.delete('-s')
      if shell = args[1]
        if silent.nil?
          puts "Run this in your shell to start using `hub` as `git`:"
          print "  "
        end
      else
        puts "usage: hub alias [-s] SHELL", ""
        puts "You already have hub installed and available in your PATH,"
        puts "but to get the full experience you'll want to alias it to"
        puts "`git`.", ""
        puts "To see how to accomplish this for your shell, run the alias"
        puts "command again with the name of your shell.", ""
        puts "Known shells:"
        shells.map { |key, _| key }.sort.each do |key|
          puts "  " + key
        end
        puts "", "Options:"
        puts "  -s   Silent. Useful when using the output with eval, e.g."
        puts "       $ eval `hub alias -s bash`"
        exit
      end
      if shells[shell]
        puts shells[shell]
      else
        abort "fatal: never heard of `#{shell}'"
      end
      exit
    end
def alias ( args ) shells = { 'sh' => 'alias git=hub' , 'bash' => 'alias git=hub' , 'zsh' => 'function git(){hub "$@"}' , 'csh' => 'alias git hub' , 'fish' => 'alias git hub' } silent = args . delete ( '-s' ) if shell = args [ 1 ] if silent . nil? puts "Run this in your shell to start using `hub` as `git`:" print "  " end else puts "usage: hub alias [-s] SHELL" , "" puts "You already have hub installed and available in your PATH," puts "but to get the full experience you'll want to alias it to" puts "`git`." , "" puts "To see how to accomplish this for your shell, run the alias" puts "command again with the name of your shell." , "" puts "Known shells:" shells . map { | key , _ | key } . sort . each do | key | puts "  " + key end puts "" , "Options:" puts "  -s   Silent. Useful when using the output with eval, e.g." puts "       $ eval `hub alias -s bash`" exit end if shells [ shell ] puts shells [ shell ] else abort "fatal: never heard of `#{shell}'" end exit end
We are a blank slate.
We are a blank slate .
args