Sha256: 22eac06c739a1c6e53115d3330d948dd2056f368d019c5c03099ff8b4562c941

Contents?: true

Size: 1.96 KB

Versions: 3

Compression:

Stored size: 1.96 KB

Contents

#!/usr/bin/env ruby
require File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib devkit]))

require 'optparse'

args = ARGV

parser = OptionParser.new do |opts|
  opts.banner = 'Usage: devkit [options] nick_name'
  opts.separator ''

  # specific options
  opts.separator 'Devkit specific options:'

  # devkit --init
  opts.on_tail('-i', '--init', 'Intializing devkit, creating .devkit file') do
    Devkit::Core.init!
  end

  # devkit --list
  opts.on_tail('-l', '--list', 'Shows list of identities') do
    Devkit::Identity.list
  end

  # devkit --purge
  opts.on_tail('-p', '--purge', 'Removes all devkit generated files') do
    Devkit::Core.purge!
  end

  # devkit --status
  opts.on_tail('-s', '--status', 'Shows current identity') do
    Devkit::Core.status
  end

  # devkit --remove praaveen
  opts.on_tail('-r nick_name', '--remove nick_name', String, 'Removes identity from .devkit file') do |nick_name|
    options = [:remove, nick_name]
    Devkit::Identity.remove!(nick_name)
  end

  # devkit --change praaveen
  opts.on_tail('-c nick_name', '--choose nick_name', String, 'Switches the identity') do |nick_name|
    options = [:choose, nick_name]
    Devkit::Identity.choose!(nick_name)
  end

  # devkit --add
  opts.on_tail('-a', '--add', 'Adding a new identity to .devkit file') do
    Devkit::Identity.add!
  end

  # devkit --drop
  opts.on_tail('-d', '--drop', 'Drop existing identities') do
    Devkit::Identity.drop!
  end

  # general options
  opts.separator 'General options:'

  # devkit --help
  opts.on_tail('-h', '--help', 'Show this message') do
    puts opts
    exit
  end

  # devkit --version
  opts.on_tail('-v', '--version', 'Show version') do
    abort "Devkit v#{Devkit::VERSION}"
  end
end

if args.any?
  begin
    parser.parse!(args)
  rescue OptionParser::MissingArgument
    puts "Missing an argument?"
    puts ""
    puts parser
  rescue OptionParser::ParseError
    puts "Missing an argument?"
    puts ""
    puts parser
  end
else
  puts parser
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
windows-pr-1.2.5 vendor/bundle/ruby/2.2.0/gems/win32-api-1.6.0-universal-mingw32/vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/bin/devkit
win32-api-1.6.0-universal-mingw32 vendor/bundle/ruby/2.2.0/gems/devkit-0.1.0/bin/devkit
devkit-0.1.0 bin/devkit