From 46ef698224c5e360683e16c367e4b26de641294a Mon Sep 17 00:00:00 2001 From: Glenn Date: Thu, 4 Jan 2024 22:54:04 +0100 Subject: [PATCH] fix: add missing patch for jinja --- shard.lock | 6 +++--- shard.yml | 2 ++ src/cli.cr | 20 +++++++++++++------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/shard.lock b/shard.lock index 832ebf3..1ed4af1 100644 --- a/shard.lock +++ b/shard.lock @@ -1,8 +1,8 @@ version: 2.0 shards: - completion: - git: https://github.com/f/completion.git - version: 0.1.0+git.commit.d8799381b2de14430496199260eca64eb329625f + crinja: + git: https://github.com/straight-shoota/crinja.git + version: 0.8.1 magic: git: https://github.com/dscottboggs/magic.cr.git diff --git a/shard.yml b/shard.yml index 308ae0a..a74f463 100644 --- a/shard.yml +++ b/shard.yml @@ -10,6 +10,8 @@ authors: - Glenn Y. Rolland dependencies: + crinja: + github: straight-shoota/crinja magic: github: dscottboggs/magic.cr walk: diff --git a/src/cli.cr b/src/cli.cr index 405a38c..6b8aedb 100644 --- a/src/cli.cr +++ b/src/cli.cr @@ -95,6 +95,7 @@ module CodePreloader def exec_pack(pack_options) abort("Unexpected nil value for pack_options!") if pack_options.nil? + preloaded_content = {} of String => NamedTuple(mime: String, content: String) output_file_path = pack_options.output_file_path repository_path_list = pack_options.repository_path_list header_prompt_file_path = pack_options.header_prompt_file_path @@ -134,7 +135,14 @@ module CodePreloader STDERR.puts "Processing repository: #{repository_path_list}".colorize(:yellow) filelist.each do |file_path| STDERR.puts "Processing file: #{file_path}".colorize(:yellow) - process_file(file_path, output_file) + file_result = process_file(file_path, output_file) + + output_file.puts "@@ File \"#{file_path}\" (Mime-Type: #{file_result[:mime]})" + output_file.puts "" + if file_result[:text_content] !~ /^\s*$/ + output_file.puts(file_result[:text_content]) + output_file.puts "" + end end footer_prompt_file_path.try { output_file.puts footer_prompt } @@ -159,12 +167,10 @@ module CodePreloader ) end - output_file.puts "@@ File \"#{file_path}\" (Mime-Type: #{mime.inspect})" - output_file.puts "" - if clean_content !~ /^\s*$/ - output_file.puts(clean_content) - output_file.puts "" - end + return { + mime: mime, + text_content: clean_content + } end end end