-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode
More file actions
executable file
·85 lines (68 loc) · 1.85 KB
/
Copy pathcode
File metadata and controls
executable file
·85 lines (68 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/usr/bin/env rvm 2.0.0@code do ruby
$: << File.join(File.dirname(__FILE__), '..', 'lib') # while this is still in development
require 'gli'
begin # XXX: Remove this begin/rescue before distributing your app
require 'code'
rescue LoadError
STDERR.puts "In development, you need to use `bundle exec bin/code` to run your app"
STDERR.puts "At install-time, RubyGems will make sure lib, etc. are in the load path"
STDERR.puts "Feel free to remove this message from bin/code now"
exit 64
end
require 'code/git'
include GLI::App
program_desc 'The Coderly Toolbelt'
version Code::VERSION
desc 'Describe some switch here'
switch [:s,:switch]
desc 'Create a new feature branch'
arg_name 'The name of the feature'
command :start do |c|
c.action do |global_options, options, (feature_name)|
$git.start feature_name
end
end
desc 'Upload your feature branch to GitHub'
command :publish do |c|
c.action do |global_options, options, args|
$git.publish
end
end
desc "Push your current branch"
command :push do |c|
c.action do |global_options, options, args|
$git.push $git.current_branch
end
end
desc 'Cleanup after a feature has been merged through GitHub'
command :finish do |c|
c.action do |global_options, options, args|
$git.finish
end
end
desc 'Delete the branch you are working on and switch back to development'
command :cancel do |c|
c.action do |global_options, options, args|
$git.cancel
end
end
command :switch do |c|
c.action do |global_options, options, args|
$git.switch(*args)
end
end
pre do |global, command, options, args|
$git = Code::Git.new
true
end
post do |global,command,options,args|
# Post logic here
# Use skips_post before a command to skip this
# block on that command only
end
on_error do |exception|
# Error logic here
# return false to skip default error handling
true
end
exit run(ARGV)