File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ def initialize(argv)
1111
1212 output = nil
1313 rbs_collection_path = nil
14+ initialize_config_file = false
1415
1516 opt . separator ""
1617 opt . separator "Options:"
@@ -39,6 +40,7 @@ def initialize(argv)
3940 opt . separator ""
4041 opt . separator "Advanced options:"
4142 opt . on ( "--[no-]stackprof MODE" , /\A cpu|wall|object\z / , "Enable stackprof (for debugging purpose)" ) { |v | cli_options [ :stackprof ] = v . to_sym }
43+ opt . on ( "--init" , 'Generate TypeProf configuration file' ) { |v | initialize_config_file = true }
4244
4345 opt . separator ""
4446 opt . separator "LSP options:"
@@ -47,6 +49,11 @@ def initialize(argv)
4749
4850 opt . parse! ( argv )
4951
52+ if initialize_config_file
53+ generate_config_file
54+ exit 0
55+ end
56+
5057 if !cli_options [ :lsp ] && !lsp_options . empty?
5158 raise OptionParser ::InvalidOption . new ( "lsp options with non-lsp mode" )
5259 end
@@ -175,5 +182,9 @@ def set_profiler
175182 StackProf . results
176183 end
177184 end
185+
186+ def generate_config_file
187+ File . write ( 'typeprof.conf.jsonc' , File . read ( File . join ( __dir__ , 'typeprof.conf.jsonc' ) ) )
188+ end
178189 end
179190end
Original file line number Diff line number Diff line change 1+ {
2+ "typeprof_version" : " experimental" ,
3+ "rbs_dir" : " sig/"
4+ // "analysis_unit_dirs": [],
5+ // "diagnostic_severity": "warning"
6+ }
You can’t perform that action at this time.
0 commit comments