cl-magic 1.2.9 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +17 -10
- data/README.md +10 -2
- data/bin/cl +2 -1
- data/bin/common/process_pids +19 -0
- data/bin/install_gem +4 -4
- data/bin/world-scripts/build +135 -0
- data/bin/world-scripts/down +78 -0
- data/bin/world-scripts/get +112 -0
- data/bin/world-scripts/rm +76 -0
- data/bin/world-scripts/up +83 -0
- data/cl-magic.gemspec +1 -1
- data/lib/cl/magic/cl +1 -1
- data/lib/cl/magic/cl-ai-chat +1 -2
- data/lib/cl/magic/cl-ai-query +1 -2
- data/lib/cl/magic/cl-ai-store-jira +1 -2
- data/lib/cl/magic/cl-auth +1 -2
- data/lib/cl/magic/cl-chrome +108 -0
- data/lib/cl/magic/cl-curl +130 -0
- data/lib/cl/magic/cl-dk +4 -0
- data/lib/cl/magic/cl-dk-make +5 -3
- data/lib/cl/magic/cl-dk-make-world +10 -19
- data/lib/cl/magic/cl-dk-parts +1 -2
- data/lib/cl/magic/cl-dk-world +33 -20
- data/lib/cl/magic/cl-envkey +1 -2
- data/lib/cl/magic/cl-gc-sql +1 -2
- data/lib/cl/magic/cl-gc-tags +1 -2
- data/lib/cl/magic/cl-glab-commit +1 -2
- data/lib/cl/magic/cl-history +1 -2
- data/lib/cl/magic/cl-jira-fetch +1 -2
- data/lib/cl/magic/cl-jira-fetch-by-epics +1 -2
- data/lib/cl/magic/cl-jira-to-elastic +1 -2
- data/lib/cl/magic/cl-jira-to-markdown +1 -2
- data/lib/cl/magic/cl-jira-to-stats +1 -2
- data/lib/cl/magic/cl-kube-cp +1 -2
- data/lib/cl/magic/cl-kube-deployment +1 -2
- data/lib/cl/magic/cl-kube-ktx +1 -2
- data/lib/cl/magic/cl-kube-logs +1 -2
- data/lib/cl/magic/cl-kube-restart +1 -2
- data/lib/cl/magic/cl-kube-search +1 -2
- data/lib/cl/magic/cl-kube-search-all +1 -2
- data/lib/cl/magic/cl-kube-ssh +1 -2
- data/lib/cl/magic/cl-poll +1 -2
- data/lib/cl/magic/cl-sandbox +1 -2
- data/lib/cl/magic/cl-vault +1 -2
- data/lib/cl/magic/common/load_runner.rb +127 -0
- data/lib/cl/magic/common/sub_command.rb +51 -0
- data/lib/cl/magic/dk/world_settings.rb +26 -0
- data/lib/cl/magic/dk/yaml_arg_munger.rb +87 -8
- data/lib/cl/magic/version.rb +1 -1
- metadata +26 -16
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Store jira json for AI
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
@@ -11,6 +9,7 @@ require 'cl/magic/common/jira.rb'
|
|
11
9
|
require 'cl/magic/common/ai_prompt.rb'
|
12
10
|
require 'cl/magic/common/milvus.rb'
|
13
11
|
require 'cl/magic/common/elastic.rb'
|
12
|
+
require 'cl/magic/common/sub_command.rb'
|
14
13
|
|
15
14
|
@logger = get_logger()
|
16
15
|
|
data/lib/cl/magic/cl-auth
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Need to authenticate? Check here first
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
@@ -9,6 +7,7 @@ require 'cl/magic/common/common_options.rb'
|
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/gcloud.rb'
|
11
9
|
require 'cl/magic/common/kubectl.rb'
|
10
|
+
require 'cl/magic/common/sub_command.rb'
|
12
11
|
|
13
12
|
@logger = get_logger()
|
14
13
|
@cl_cmd_name = "cl auth"
|
@@ -0,0 +1,108 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Request a page with the chrome browser
|
3
|
+
require 'tty-command'
|
4
|
+
require 'tty-prompt'
|
5
|
+
|
6
|
+
require 'cl/magic/common/common_options.rb'
|
7
|
+
require 'cl/magic/common/logging.rb'
|
8
|
+
require 'cl/magic/common/gcloud.rb'
|
9
|
+
require 'cl/magic/common/kubectl.rb'
|
10
|
+
require 'cl/magic/common/sub_command.rb'
|
11
|
+
|
12
|
+
require 'selenium-webdriver'
|
13
|
+
|
14
|
+
@logger = get_logger()
|
15
|
+
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
16
|
+
|
17
|
+
#
|
18
|
+
# Features
|
19
|
+
#
|
20
|
+
|
21
|
+
def do_work(options)
|
22
|
+
@logger.info "start #{Time.now.strftime("%H:%M:%S")}"
|
23
|
+
concurrent = options[:concurrent]
|
24
|
+
|
25
|
+
begin
|
26
|
+
|
27
|
+
# create drivers
|
28
|
+
drivers = []
|
29
|
+
concurrent.times { drivers << Selenium::WebDriver.for(:chrome) }
|
30
|
+
|
31
|
+
# browse pages
|
32
|
+
options[:ids].each_slice(concurrent) do |ids|
|
33
|
+
ids.each_with_index do |id, i|
|
34
|
+
drivers[i].navigate.to URI.join(options[:uri], id)
|
35
|
+
end
|
36
|
+
sleep options[:sleep]
|
37
|
+
end
|
38
|
+
|
39
|
+
ensure
|
40
|
+
drivers.each {|d| d.quit }
|
41
|
+
end
|
42
|
+
@logger.info "end #{Time.now.strftime("%H:%M:%S")}"
|
43
|
+
end
|
44
|
+
|
45
|
+
#
|
46
|
+
# Options
|
47
|
+
#
|
48
|
+
|
49
|
+
options = {
|
50
|
+
concurrent: 1,
|
51
|
+
sleep: 0.1
|
52
|
+
}
|
53
|
+
global_banner = <<DOC
|
54
|
+
|
55
|
+
A sandbox to try things
|
56
|
+
|
57
|
+
Usage: #{@cl_cmd_name} [options]
|
58
|
+
|
59
|
+
DOC
|
60
|
+
|
61
|
+
global = OptionParser.new do |g|
|
62
|
+
g.banner = global_banner
|
63
|
+
add_help_and_verbose(g)
|
64
|
+
|
65
|
+
g.on("--base-uri URI", "uri to attach identifier to and browse") do |v|
|
66
|
+
options[:uri] = v
|
67
|
+
end
|
68
|
+
|
69
|
+
g.on("--ids CSV", "comma separated list of ids") do |v|
|
70
|
+
options[:ids] = v.split(',')
|
71
|
+
end
|
72
|
+
|
73
|
+
g.on("-c", "--concurrent NUMBER", "number of concurrent chromes to open (default: 1)") do |v|
|
74
|
+
options[:concurrent] = v.to_i
|
75
|
+
end
|
76
|
+
|
77
|
+
g.on("-s", "--sleep NUMBER", "number of seconds to sleep after opening page (default: 0.1)") do |v|
|
78
|
+
options[:sleep] = v.to_f
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
#
|
83
|
+
# Run
|
84
|
+
#
|
85
|
+
|
86
|
+
@working_dir = ENV['CL_WORKING_DIR'] # passed through cl-magic to here
|
87
|
+
global.parse(ARGV)
|
88
|
+
|
89
|
+
|
90
|
+
if options[:uri].nil?
|
91
|
+
@logger.error "missing --base-uri"
|
92
|
+
exit
|
93
|
+
end
|
94
|
+
if options[:ids].nil?
|
95
|
+
@logger.error "missing --ids"
|
96
|
+
exit
|
97
|
+
end
|
98
|
+
|
99
|
+
|
100
|
+
# display full command
|
101
|
+
write_history("""#{@cl_cmd_name} \\
|
102
|
+
--base-uri='#{options[:uri]}' \\
|
103
|
+
--ids=#{options[:ids].join(',')} \\
|
104
|
+
--sleep=#{options[:sleep]} \\
|
105
|
+
--concurrent=#{options[:concurrent]}
|
106
|
+
""")
|
107
|
+
|
108
|
+
do_work(options)
|
@@ -0,0 +1,130 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# curl web pages by id
|
3
|
+
require 'tty-command'
|
4
|
+
require 'tty-prompt'
|
5
|
+
|
6
|
+
require 'cl/magic/common/sub_command.rb'
|
7
|
+
require 'cl/magic/common/common_options.rb'
|
8
|
+
require 'cl/magic/common/logging.rb'
|
9
|
+
require 'cl/magic/common/load_runner.rb'
|
10
|
+
|
11
|
+
@logger = get_logger()
|
12
|
+
@se_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
13
|
+
|
14
|
+
#
|
15
|
+
# Features
|
16
|
+
#
|
17
|
+
|
18
|
+
def do_curls(options)
|
19
|
+
options[:ids].shuffle.each do |id|
|
20
|
+
uri = "#{options[:uri]}/#{id}"
|
21
|
+
status_code = `curl -s -o /dev/null -w \"%{http_code}\" #{uri}`
|
22
|
+
@logger.info "uri=#{uri}|status=#{status_code}"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def load_and_run(q, options)
|
27
|
+
q.load(options[:threads]) { do_curls(options) }
|
28
|
+
q.run
|
29
|
+
end
|
30
|
+
|
31
|
+
def run_for_durration(q, options)
|
32
|
+
num_seconds = 10
|
33
|
+
max_sleep = options[:max_sleep]
|
34
|
+
q.load(options[:threads]) { do_curls(options) }
|
35
|
+
q.run_for_durration(num_seconds, max_sleep)
|
36
|
+
end
|
37
|
+
|
38
|
+
def run_and_stagger(q, options)
|
39
|
+
max_sleep = options[:max_sleep]
|
40
|
+
q.load(options[:threads]) { do_curls(options) }
|
41
|
+
q.run_for_durration(max_sleep)
|
42
|
+
end
|
43
|
+
|
44
|
+
def do_work(options)
|
45
|
+
q = LoadRunner::Queue.new(@logger)
|
46
|
+
if options[:durration]
|
47
|
+
@logger.info "run for durration"
|
48
|
+
run_for_durration(q, options)
|
49
|
+
else
|
50
|
+
if options[:max_sleep] > 0
|
51
|
+
@logger.info "run and stagger"
|
52
|
+
run_and_stagger(q, options)
|
53
|
+
else
|
54
|
+
@logger.info "load and run"
|
55
|
+
load_and_run(q, options)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# Options
|
62
|
+
#
|
63
|
+
|
64
|
+
options = {
|
65
|
+
threads: 1,
|
66
|
+
max_sleep: 0
|
67
|
+
}
|
68
|
+
global_banner = <<DOC
|
69
|
+
|
70
|
+
curl web pages by id
|
71
|
+
|
72
|
+
Usage: #{@se_cmd_name} [options]
|
73
|
+
|
74
|
+
DOC
|
75
|
+
|
76
|
+
global = OptionParser.new do |g|
|
77
|
+
g.banner = global_banner
|
78
|
+
add_help_and_verbose(g)
|
79
|
+
|
80
|
+
g.on("--base-uri URI", "uri to curl") do |v|
|
81
|
+
options[:uri] = v
|
82
|
+
end
|
83
|
+
|
84
|
+
g.on("--ids CSV", "comma separated list of ids") do |v|
|
85
|
+
options[:ids] = v.split(',')
|
86
|
+
end
|
87
|
+
|
88
|
+
g.on("-t", "--thread NUMBER", "number of threads (default: 1)") do |v|
|
89
|
+
options[:threads] = v.to_i
|
90
|
+
end
|
91
|
+
|
92
|
+
g.on("--max-sleep NUMBER", "max number of seconds to sleep; randomly staggers requests") do |v|
|
93
|
+
options[:max_sleep] = v.to_i
|
94
|
+
end
|
95
|
+
|
96
|
+
g.on("--durration SECONDS", "run threads for a specific amount of time") do |v|
|
97
|
+
options[:durration] = v.to_i
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Run
|
103
|
+
#
|
104
|
+
|
105
|
+
@working_dir = ENV['SE_WORKING_DIR'] # passed through se-magic to here
|
106
|
+
global.parse(ARGV)
|
107
|
+
|
108
|
+
if options[:uri].nil?
|
109
|
+
@logger.error "missing --base-uri"
|
110
|
+
exit
|
111
|
+
end
|
112
|
+
if options[:ids].nil?
|
113
|
+
@logger.error "missing --ids"
|
114
|
+
exit
|
115
|
+
end
|
116
|
+
|
117
|
+
history_command = """#{@se_cmd_name} \\
|
118
|
+
--base-uri #{options[:uri]} \\
|
119
|
+
--ids #{options[:ids].join(',')} \\
|
120
|
+
--thread #{options[:threads]} \\
|
121
|
+
--max-sleep #{options[:max_sleep]}
|
122
|
+
"""
|
123
|
+
|
124
|
+
history_command = """#{history_command.strip} \\
|
125
|
+
--durration #{options[:durration]}
|
126
|
+
""" if options[:durration]
|
127
|
+
|
128
|
+
write_history(history_command)
|
129
|
+
|
130
|
+
do_work(options)
|
data/lib/cl/magic/cl-dk
CHANGED
@@ -44,6 +44,10 @@ def try_print_dk_help(dk_parts_hash, dk_make_hash, args)
|
|
44
44
|
puts " - <dk-project-path> absolute filepath to world/project directory"
|
45
45
|
puts " - <dk-working-path> absolute filepath to location dk command was run from"
|
46
46
|
puts ""
|
47
|
+
puts "PATHS"
|
48
|
+
puts " - world-path: #{@world_settings.get_world_path_from_settings()}"
|
49
|
+
puts " - project-path: #{@world_settings.get_world_project_path()}"
|
50
|
+
puts " - working-path: #{@working_dir}"
|
47
51
|
puts "-------------------------"
|
48
52
|
end
|
49
53
|
end
|
data/lib/cl/magic/cl-dk-make
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# cli for your compose projects
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
|
6
4
|
require 'cl/magic/common/common_options.rb'
|
7
5
|
require 'cl/magic/common/logging.rb'
|
6
|
+
require 'cl/magic/common/sub_command.rb'
|
8
7
|
|
9
8
|
require_relative 'dk/help_printer'
|
10
9
|
require_relative 'dk/yaml_arg_munger'
|
@@ -98,7 +97,7 @@ def prep_make_command(c, selected_parts)
|
|
98
97
|
|
99
98
|
# run command
|
100
99
|
c = interpolate_parts_into_command(c, selected_parts)
|
101
|
-
cmd = "cd #{@working_dir} && #{c}"
|
100
|
+
cmd = "cd #{@working_dir} && WORLD_DIR=#{@world_path} CODE_DIR=#{@code_path} WORKING_DIR=#{@working_dir} #{c}"
|
102
101
|
end
|
103
102
|
|
104
103
|
def interpolate_parts_into_command(cmd, selected_parts)
|
@@ -136,6 +135,9 @@ def do_work()
|
|
136
135
|
@yaml_arg_munger = YamlArgMunger.new(@working_dir, @world_settings)
|
137
136
|
@parts_merger = PartsMerger.new(@working_dir, @yaml_arg_munger, @help_printer, @logger)
|
138
137
|
|
138
|
+
@world_path = @world_settings.get_world_path_from_settings()
|
139
|
+
@code_path = @world_settings.get_code_path_from_settings()
|
140
|
+
|
139
141
|
# world files
|
140
142
|
compose_hash, dk_parts_hash, dk_make_hash = @yaml_arg_munger.get_base_compose_parts_and_make_hashes()
|
141
143
|
if compose_hash
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# cli for your world
|
3
|
+
|
3
4
|
require 'yaml'
|
4
|
-
require 'optparse'
|
5
|
-
require 'optparse/subcommand'
|
6
5
|
require 'tty-command'
|
7
6
|
|
8
7
|
require 'cl/magic/common/common_options.rb'
|
9
8
|
require 'cl/magic/common/logging.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
10
10
|
|
11
11
|
require_relative 'dk/help_printer'
|
12
12
|
require_relative 'dk/world_settings'
|
@@ -94,7 +94,7 @@ def prep_make_command(c)
|
|
94
94
|
@logger.wait(c.gsub("cl dk", "dk"))
|
95
95
|
|
96
96
|
# run command - from world path
|
97
|
-
cmd = "cd #{@world_path} && WORKING_DIR=#{@working_dir} #{c}"
|
97
|
+
cmd = "cd #{@world_path} && WORLD_DIR=#{@world_path} CODE_DIR=#{@code_path} WORKING_DIR=#{@working_dir} #{c}"
|
98
98
|
end
|
99
99
|
|
100
100
|
#
|
@@ -102,29 +102,19 @@ end
|
|
102
102
|
#
|
103
103
|
|
104
104
|
def do_work()
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
if File.exist?(world_yaml_filepath)
|
109
|
-
|
110
|
-
# read file, replace & yaml load
|
111
|
-
contents = File.read(world_yaml_filepath)
|
112
|
-
contents.gsub!('<dk-working-path>', @working_dir)
|
113
|
-
yml_hash = YAML.load(contents)
|
114
|
-
|
115
|
-
# run command
|
116
|
-
if yml_hash and yml_hash.key? "x-dk-make-world"
|
105
|
+
yml_hash = @world_settings.get_world_yml_hash()
|
106
|
+
if yml_hash
|
107
|
+
if yml_hash.key? "x-dk-make-world"
|
117
108
|
run_dk_make(ARGV, yml_hash["x-dk-make-world"])
|
118
109
|
else
|
119
110
|
@logger.puts ""
|
120
|
-
@logger.warn "
|
121
|
-
@logger.info "#{world_yaml_filepath}"
|
111
|
+
@logger.warn "missing: x-dk-make-world in world.yml"
|
122
112
|
@logger.puts ""
|
123
113
|
end
|
124
114
|
else
|
125
115
|
@logger.puts ""
|
126
|
-
@logger.warn "
|
127
|
-
@logger.info "#{world_path}"
|
116
|
+
@logger.warn "missing: world.yml"
|
117
|
+
@logger.info "#{@world_path}"
|
128
118
|
@logger.puts ""
|
129
119
|
end
|
130
120
|
end
|
@@ -163,5 +153,6 @@ global.parse(ARGV)
|
|
163
153
|
|
164
154
|
# world path
|
165
155
|
@world_path = @world_settings.get_world_path_from_settings()
|
156
|
+
@code_path = @world_settings.get_code_path_from_settings()
|
166
157
|
|
167
158
|
do_work()
|
data/lib/cl/magic/cl-dk-parts
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# set, list and clear parts for a compose project
|
3
3
|
require 'yaml'
|
4
|
-
require 'optparse'
|
5
|
-
require 'optparse/subcommand'
|
6
4
|
require 'tty-command'
|
7
5
|
|
8
6
|
require 'cl/magic/common/common_options.rb'
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/parse_and_pick.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
11
10
|
|
12
11
|
require_relative 'dk/help_printer'
|
13
12
|
require_relative 'dk/yaml_arg_munger'
|
data/lib/cl/magic/cl-dk-world
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# set world and context for dk tool
|
3
3
|
require 'yaml'
|
4
|
-
require 'optparse'
|
5
|
-
require 'optparse/subcommand'
|
6
4
|
require 'tty-command'
|
7
5
|
|
8
6
|
require 'cl/magic/common/common_options.rb'
|
9
7
|
require 'cl/magic/common/parse_and_pick.rb'
|
10
8
|
require 'cl/magic/common/logging.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
11
10
|
|
12
11
|
require_relative 'dk/world_settings'
|
13
12
|
|
14
13
|
@logger = get_logger()
|
15
14
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
16
15
|
|
16
|
+
def expand_path(path)
|
17
|
+
if path.start_with?("/") or path.start_with?("~")
|
18
|
+
return File.expand_path(path)
|
19
|
+
else
|
20
|
+
return File.expand_path(File.join(@working_dir, path))
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
17
24
|
#
|
18
25
|
# Features
|
19
26
|
#
|
@@ -21,23 +28,19 @@ require_relative 'dk/world_settings'
|
|
21
28
|
def set(options, world_settings)
|
22
29
|
world_settings_hash = world_settings.get_world_settings_hash()
|
23
30
|
|
24
|
-
#
|
25
|
-
world_path = options[:world_path]
|
31
|
+
# expand paths
|
32
|
+
world_path = expand_path(options[:world_path])
|
33
|
+
code_path = expand_path(options[:code_path])
|
26
34
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
world_path = File.expand_path(File.join(@working_dir, world_path))
|
31
|
-
end
|
32
|
-
|
33
|
-
if TTY::Prompt.new.yes?("Set world to: #{world_path}?")
|
34
|
-
world_settings_hash[:world_path] = world_path
|
35
|
-
world_settings.save_world_settings(world_settings_hash)
|
36
|
-
switch_context(world_settings)
|
37
|
-
else
|
38
|
-
exit
|
39
|
-
end
|
35
|
+
# confirm
|
36
|
+
exit unless TTY::Prompt.new.yes?("Set world to: #{world_path}?")
|
37
|
+
exit unless TTY::Prompt.new.yes?("Set code to: #{code_path}?")
|
40
38
|
|
39
|
+
# set & switch context
|
40
|
+
world_settings_hash[:code_path] = code_path
|
41
|
+
world_settings_hash[:world_path] = world_path
|
42
|
+
world_settings.save_world_settings(world_settings_hash)
|
43
|
+
switch_context(world_settings)
|
41
44
|
end
|
42
45
|
|
43
46
|
def switch_context(world_settings)
|
@@ -98,9 +101,13 @@ global = OptionParser.new do |g|
|
|
98
101
|
s.banner = dk_world_set_banner
|
99
102
|
options[:action] = :set
|
100
103
|
|
101
|
-
s.on("-
|
104
|
+
s.on("-w", "--world PATH", "path to world folder") do |v|
|
102
105
|
options[:world_path] = v
|
103
106
|
end
|
107
|
+
|
108
|
+
s.on("-c", "--code PATH", "path to clone repos into") do |v|
|
109
|
+
options[:code_path] = v
|
110
|
+
end
|
104
111
|
end
|
105
112
|
|
106
113
|
g.subcommand 'switch_context' do |s|
|
@@ -123,12 +130,18 @@ world_settings = WorldSettings.new(@working_dir)
|
|
123
130
|
case options[:action]
|
124
131
|
when :set
|
125
132
|
if options[:world_path].nil?
|
126
|
-
@logger.error("missing --
|
133
|
+
@logger.error("missing --world argument")
|
134
|
+
exit 1
|
135
|
+
end
|
136
|
+
|
137
|
+
if options[:code_path].nil?
|
138
|
+
@logger.error("missing --code argument")
|
127
139
|
exit 1
|
128
140
|
end
|
129
141
|
|
130
142
|
history_command = """#{@cl_cmd_name} world set \\
|
131
|
-
--
|
143
|
+
--world #{options[:world_path]} \
|
144
|
+
--code #{options[:code_path]}
|
132
145
|
"""
|
133
146
|
write_history(history_command)
|
134
147
|
|
data/lib/cl/magic/cl-envkey
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Human readable envkeys
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
@@ -9,6 +7,7 @@ require 'cl/magic/common/common_options.rb'
|
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/gcloud.rb'
|
11
9
|
require 'cl/magic/common/kubectl.rb'
|
10
|
+
require 'cl/magic/common/sub_command.rb'
|
12
11
|
|
13
12
|
@logger = get_logger()
|
14
13
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
data/lib/cl/magic/cl-gc-sql
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Connect to google cloud sql instance
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
8
6
|
require 'cl/magic/common/common_options.rb'
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/gcloud.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
11
10
|
|
12
11
|
@logger = get_logger()
|
13
12
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
data/lib/cl/magic/cl-gc-tags
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Work with gcloud docker image tags
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
|
7
5
|
require 'cl/magic/common/common_options.rb'
|
8
6
|
require 'cl/magic/common/logging.rb'
|
9
7
|
require 'cl/magic/common/gcloud.rb'
|
10
8
|
require 'cl/magic/common/kubectl.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
11
10
|
|
12
11
|
@logger = get_logger()
|
13
12
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
data/lib/cl/magic/cl-glab-commit
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Find a commit and open in a browser
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
@@ -9,6 +7,7 @@ require 'cl/magic/common/common_options.rb'
|
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/gcloud.rb'
|
11
9
|
require 'cl/magic/common/kubectl.rb'
|
10
|
+
require 'cl/magic/common/sub_command.rb'
|
12
11
|
|
13
12
|
@logger = get_logger()
|
14
13
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
data/lib/cl/magic/cl-history
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# History of 'cl' commands you run
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
|
7
5
|
require 'cl/magic/common/common_options.rb'
|
8
6
|
require 'cl/magic/common/logging.rb'
|
7
|
+
require 'cl/magic/common/sub_command.rb'
|
9
8
|
|
10
9
|
@logger = get_logger()
|
11
10
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|
data/lib/cl/magic/cl-jira-fetch
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Fetch jira issues by jql
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
8
6
|
require 'cl/magic/common/common_options.rb'
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/jira.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
11
10
|
|
12
11
|
require 'net/http'
|
13
12
|
require 'json'
|
@@ -1,13 +1,12 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Fetch jira issues, status changelogs and save them to a file
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
8
6
|
require 'cl/magic/common/common_options.rb'
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/jira.rb'
|
9
|
+
require 'cl/magic/common/sub_command.rb'
|
11
10
|
|
12
11
|
require 'net/http'
|
13
12
|
require 'json'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Jira fetch datafile to markdown
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
require 'active_support/all'
|
@@ -10,6 +8,7 @@ require 'cl/magic/common/parse_and_pick.rb'
|
|
10
8
|
require 'cl/magic/common/common_options.rb'
|
11
9
|
require 'cl/magic/common/logging.rb'
|
12
10
|
require 'cl/magic/common/jira.rb'
|
11
|
+
require 'cl/magic/common/sub_command.rb'
|
13
12
|
|
14
13
|
require 'json'
|
15
14
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Jira fetch datafile to markdown
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
require 'active_support/all'
|
@@ -10,6 +8,7 @@ require 'cl/magic/common/parse_and_pick.rb'
|
|
10
8
|
require 'cl/magic/common/common_options.rb'
|
11
9
|
require 'cl/magic/common/logging.rb'
|
12
10
|
require 'cl/magic/common/jira.rb'
|
11
|
+
require 'cl/magic/common/sub_command.rb'
|
13
12
|
|
14
13
|
require 'json'
|
15
14
|
|
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Jira fetch datafile to stats
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
require 'active_support/all'
|
@@ -9,6 +7,7 @@ require 'active_support/all'
|
|
9
7
|
require 'cl/magic/common/common_options.rb'
|
10
8
|
require 'cl/magic/common/logging.rb'
|
11
9
|
require 'cl/magic/common/jira.rb'
|
10
|
+
require 'cl/magic/common/sub_command.rb'
|
12
11
|
|
13
12
|
require 'net/http'
|
14
13
|
require 'json'
|
data/lib/cl/magic/cl-kube-cp
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Copy a file to a container in K8
|
3
|
-
require 'optparse'
|
4
|
-
require 'optparse/subcommand'
|
5
3
|
require 'tty-command'
|
6
4
|
require 'tty-prompt'
|
7
5
|
|
@@ -9,6 +7,7 @@ require 'cl/magic/common/common_options.rb'
|
|
9
7
|
require 'cl/magic/common/logging.rb'
|
10
8
|
require 'cl/magic/common/gcloud.rb'
|
11
9
|
require 'cl/magic/common/kubectl.rb'
|
10
|
+
require 'cl/magic/common/sub_command.rb'
|
12
11
|
|
13
12
|
@logger = get_logger()
|
14
13
|
@cl_cmd_name = File.basename(__FILE__).split('-').join(' ')
|