Skip to content

Instantly share code, notes, and snippets.

@conradwt
Created June 18, 2018 22:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save conradwt/7e7b4da7cf98c08b950caa525a9f8732 to your computer and use it in GitHub Desktop.
Save conradwt/7e7b4da7cf98c08b950caa525a9f8732 to your computer and use it in GitHub Desktop.
build amber from the master branch
$ make
Building amber in /Users/conradwt/crystal.dir/projects/amber/bin/amber
Error in src/amber/cli.cr:5: while requiring "./cli/commands"
require "./cli/commands"
^
in src/amber/cli/commands.cr:7: while requiring "./commands/*"
require "./commands/*"
^
in src/amber/cli/commands/generate.cr:7: expanding macro
class Generate < Command
^
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 62:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
23. rescue_exit(cmd) do
24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
> 62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'Cli::CommandClass+#amber_cli_main_command_generate__run(Cli::CommandBase+, Array(String))'
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 17:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
> 17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
23. rescue_exit(cmd) do
24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'amber_cli_main_command_generate__run(Cli::CommandBase+, Array(String))'
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 23:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
> 23. rescue_exit(cmd) do
24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'rescue_exit(Amber::CLI::MainCommand::Generate)'
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 23:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
> 23. rescue_exit(cmd) do
24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'rescue_exit(Amber::CLI::MainCommand::Generate)'
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 24:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
23. rescue_exit(cmd) do
> 24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'rescue_error(Amber::CLI::MainCommand::Generate)'
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 24:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
23. rescue_exit(cmd) do
> 24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'rescue_error(Amber::CLI::MainCommand::Generate)'
in macro 'inherited' /Users/conradwt/crystal.dir/projects/amber/lib/cli/src/lib/command_base.cr:10, line 95:
1.
2.
3.
4.
5.
6.
7.
8. inherit_callback_group :initialize
9. inherit_callback_group :exit, proc_type: Proc(::Cli::Exit, Nil)
10.
11.
12. # The dedicated Cli::OptionModel subclass for the `Generate` class.
13. #
14. # This class is automatically defined by the Crystal CLI library.
15. class Options < ::Command::Options
16. end
17.
18. # :nodoc:
19. macro __define_run(klass)
20. {%
21. klass = klass.resolve if klass.class_name == "Path"
22. %}
23. # :nodoc:
24. class ::Cli::CommandClass
25.
26. # :nodoc:
27. def amber_cli_main_command_generate__run(argv)
28. amber_cli_main_command_generate__run(nil, argv)
29. end
30.
31. # :nodoc:
32. def amber_cli_main_command_generate__run(argv, &block : ::{{klass}} ->)
33. amber_cli_main_command_generate__run(nil, argv, &block)
34. end
35.
36. # :nodoc:
37. def amber_cli_main_command_generate__run(previous, argv)
38. amber_cli_main_command_generate__run(previous, argv) {}
39. end
40.
41. # :nodoc:
42. def amber_cli_main_command_generate__run(previous, argv, &block : ::{{klass}} ->)
43. cmd = ::{{klass}}.new(previous, argv)
44. rescue_exit(cmd) do
45. rescue_error(cmd) do
46. begin
47. cmd.__option_data.__parse
48. result = cmd.run
49. cmd.io.close_writer unless previous
50. yield cmd
51. result
52. ensure
53. cmd.io.close_writer unless previous
54. end
55. end
56. end
57. end
58.
59. # :nodoc:
60. def rescue_exit(cmd)
61. if cmd.__previous?
62. yield
63. else
64. begin
65. result = yield
66. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
67. result
68. rescue ex : ::Cli::Exit
69. if ::Cli.test?
70. cmd.run_callbacks_for_exit(ex) {}
71. ex
72. else
73. cmd.run_callbacks_for_exit ex do
74. ex.stdout.puts ex.message if ex.message
75. end
76. exit ex.exit_code
77. end
78. end
79. end
80. end
81.
82. @@runners[{{klass.name.stringify}}] = Runner.new do |previous, args|
83. ::{{klass}}.__klass.amber_cli_main_command_generate__run(previous, args)
84. end
85.
86. end
87.
88. # Run the command.
89. #
90. # This method is automatically defined by the Crystal CLI library.
91. def self.run(argv : Array(String) = \%w(), &block : ::{{klass}} ->)
92. __klass.amber_cli_main_command_generate__run(argv, &block)
93. end
94. end
> 95. __define_run ::Amber::CLI::MainCommand::Generate
96.
97. @@__klass = ::Cli::CommandClass.new(
98. supercommand: __get_supercommand_class,
99. inherited_class: ::Command.__klass,
100. class_name: "Amber::CLI::MainCommand::Generate",
101. name: ::StringInflection.kebab(::Amber::CLI::MainCommand::Generate.name.split("::").last),
102. is_supercommand: false,
103. abstract: false,
104. options: Options.__klass
105. )
106.
107. # :nodoc:
108. def self.__klass; @@__klass; end
109.
110. # :nodoc:
111. def __klass; @@__klass; end
112.
113.
114. if @@__klass.supercommand?
115. @@__klass.supercommand << @@__klass
116. end
117.
118. # Run the command.
119. #
120. # This method is automatically defined by the Crystal CLI library.
121. def self.run
122. run(%w())
123. end
124.
125. # Run the command.
126. #
127. # This method is automatically defined by the Crystal CLI library.
128. def self.run(argv : Array(String))
129. __klass.amber_cli_main_command_generate__run(argv)
130. end
131.
132. # Run the command.
133. #
134. # This method is automatically defined by the Crystal CLI library.
135. def self.run(previous : ::Cli::CommandBase, argv : Array(String) = %w())
136. __klass.amber_cli_main_command_generate__run(previous, argv)
137. end
138.
139.
140. class Options
141. # :nodoc:
142. def self.__cli_command
143. ::Amber::CLI::MainCommand::Generate
144. end
145.
146. # :nodoc:
147. def __cli_command
148. @__cli_command.as(::Amber::CLI::MainCommand::Generate)
149. end
150.
151.
152. end
153.
154. # Configures help message attributes for the `Generate` class.
155. #
156. # This class is automatically defined by the Crystal CLI library.
157. class Help
158. # Sets the caption.
159. def self.caption(s : String)
160. ::Amber::CLI::MainCommand::Generate.__klass.caption = s
161. end
162.
163. # Sets the title.
164. def self.title(s : String)
165. ::Amber::CLI::MainCommand::Generate.__klass.title = s
166. end
167.
168. # Sets the header.
169. def self.header(s : String)
170. ::Amber::CLI::MainCommand::Generate.__klass.header = s
171. end
172.
173. # Sets the footer.
174. def self.footer(s : String)
175. ::Amber::CLI::MainCommand::Generate.__klass.footer = s
176. end
177.
178. # Sets the string for unparsed arguments.
179. def self.unparsed_args(s)
180. ::Amber::CLI::MainCommand::Generate.__klass.unparsed_args = s
181. end
182. end
183.
184. # :nodoc:
185. def __option_data
186. (@__option_data.var ||= Options.new(@__argv, self)).as(Options)
187. end
188.
189.
expanding macro
in macro '__define_run' expanded macro: inherited:19, line 27:
1.
2. # :nodoc:
3. class ::Cli::CommandClass
4.
5. # :nodoc:
6. def amber_cli_main_command_generate__run(argv)
7. amber_cli_main_command_generate__run(nil, argv)
8. end
9.
10. # :nodoc:
11. def amber_cli_main_command_generate__run(argv, &block : ::Amber::CLI::MainCommand::Generate ->)
12. amber_cli_main_command_generate__run(nil, argv, &block)
13. end
14.
15. # :nodoc:
16. def amber_cli_main_command_generate__run(previous, argv)
17. amber_cli_main_command_generate__run(previous, argv) {}
18. end
19.
20. # :nodoc:
21. def amber_cli_main_command_generate__run(previous, argv, &block : ::Amber::CLI::MainCommand::Generate ->)
22. cmd = ::Amber::CLI::MainCommand::Generate.new(previous, argv)
23. rescue_exit(cmd) do
24. rescue_error(cmd) do
25. begin
26. cmd.__option_data.__parse
> 27. result = cmd.run
28. cmd.io.close_writer unless previous
29. yield cmd
30. result
31. ensure
32. cmd.io.close_writer unless previous
33. end
34. end
35. end
36. end
37.
38. # :nodoc:
39. def rescue_exit(cmd)
40. if cmd.__previous?
41. yield
42. else
43. begin
44. result = yield
45. cmd.run_callbacks_for_exit(::Cli::Exit.new) {}
46. result
47. rescue ex : ::Cli::Exit
48. if ::Cli.test?
49. cmd.run_callbacks_for_exit(ex) {}
50. ex
51. else
52. cmd.run_callbacks_for_exit ex do
53. ex.stdout.puts ex.message if ex.message
54. end
55. exit ex.exit_code
56. end
57. end
58. end
59. end
60.
61. @@runners["Amber::CLI::MainCommand::Generate"] = Runner.new do |previous, args|
62. ::Amber::CLI::MainCommand::Generate.__klass.amber_cli_main_command_generate__run(previous, args)
63. end
64.
65. end
66.
67. # Run the command.
68. #
69. # This method is automatically defined by the Crystal CLI library.
70. def self.run(argv : Array(String) = %w(), &block : ::Amber::CLI::MainCommand::Generate ->)
71. __klass.amber_cli_main_command_generate__run(argv, &block)
72. end
73.
instantiating 'Amber::CLI::MainCommand::Generate#run()'
in src/amber/cli/commands/generate.cr:34: instantiating '(Amber::CLI::Template | Amber::Recipes::Recipe)#generate(String)'
template.generate args.type
^~~~~~~~
in src/amber/cli/recipes/recipe.cr:53: instantiating 'generate(String, Nil)'
def generate(template : String, options = nil)
^
in src/amber/cli/recipes/recipe.cr:66: instantiating 'Amber::Recipes::Controller#render(String)'
Controller.new(name, @recipe, @fields).render(directory, list: true, color: true)
^~~~~~
in src/amber/cli/templates/template.cr:171: instantiating 'file_entries()'
renderer << filter(file_entries)
^~~~~~~~~~~~
in src/amber/cli/recipes/file_entries.cr:62: instantiating 'collect_files(Array(Teeplate::AsDataEntry))'
collect_files files
^~~~~~~~~~~~~
in src/amber/cli/recipes/file_entries.cr:46: instantiating 'Liquid::Template#render(Liquid::Context)'
filename = template.render @ctx.as(Liquid::Context)
^~~~~~
in lib/liquid/src/liquid/template.cr:28: instantiating 'render(Liquid::Context, IO::Memory)'
def render(data, io = IO::Memory.new)
^
in lib/liquid/src/liquid/template.cr:30: instantiating 'Liquid::RenderVisitor#visit(Liquid::Block::Root)'
visitor.visit @root
^~~~~
in lib/liquid/src/liquid/render_visitor.cr:50: instantiating 'Array(Liquid::Block::Node)#each()'
node.children.each &.accept(self)
^~~~
in /opt/local/lib/crystal/indexable.cr:148: instantiating 'each_index()'
each_index do |i|
^~~~~~~~~~
in /opt/local/lib/crystal/indexable.cr:148: instantiating 'each_index()'
each_index do |i|
^~~~~~~~~~
in lib/liquid/src/liquid/render_visitor.cr:50: instantiating 'Array(Liquid::Block::Node)#each()'
node.children.each &.accept(self)
^~~~
in lib/liquid/src/liquid/render_visitor.cr:50: instantiating 'Liquid::Block::Node+#accept(Liquid::RenderVisitor)'
node.children.each &.accept(self)
^~~~~~
in lib/liquid/src/liquid/blocks/block.cr:20: instantiating 'Liquid::RenderVisitor#visit(Liquid::Block::Node+)'
visitor.visit self
^~~~~
in lib/liquid/src/liquid/render_visitor.cr:118: instantiating 'Array(Tuple(Liquid::Filters::Filter, Array(Liquid::Block::Expression) | Nil))#each()'
node.filters.each do |tuple|
^~~~
in /opt/local/lib/crystal/indexable.cr:148: instantiating 'each_index()'
each_index do |i|
^~~~~~~~~~
in /opt/local/lib/crystal/indexable.cr:148: instantiating 'each_index()'
each_index do |i|
^~~~~~~~~~
in lib/liquid/src/liquid/render_visitor.cr:118: instantiating 'Array(Tuple(Liquid::Filters::Filter, Array(Liquid::Block::Expression) | Nil))#each()'
node.filters.each do |tuple|
^~~~
in lib/liquid/src/liquid/render_visitor.cr:120: instantiating 'Liquid::Filters::Filter#filter(JSON::Any, (Array(JSON::Any) | Nil))'
result = tuple[0].filter(result, args)
^~~~~~
in lib/liquid/src/liquid/filters/compact.cr:10: undefined method 'raw' for Array(JSON::Type) (compile-time type is JSON::Type)
result = d.reject &.raw.nil?
^~~
make: *** [/Users/conradwt/crystal.dir/projects/amber/bin/amber] Error 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment