From 5055b03a56190b8742157a4652334d234742df88 Mon Sep 17 00:00:00 2001 From: o-200 Date: Mon, 9 Feb 2026 03:17:46 +0700 Subject: [PATCH 1/2] added file uploading with their content --- lib/neocities/cli.rb | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/neocities/cli.rb b/lib/neocities/cli.rb index fa3a270..efbc953 100644 --- a/lib/neocities/cli.rb +++ b/lib/neocities/cli.rb @@ -309,16 +309,23 @@ def upload next end - if path.directory? - puts "#{path} is a directory, skipping (see the push command)" - next + if path.file? + files_to_upload = [path] + remote_paths = [['/', @dir, path.basename.to_s].join('/').gsub(%r{/+}, '/')] + else # directory + files_to_upload = path.glob("**/*").select(&:file?) + remote_paths = files_to_upload.map { |file| ['/', @dir, file.to_s].join('/').gsub(%r{/+}, '/') } end + + files_to_upload.count.times do |file_number| + file = files_to_upload[file_number] + remote_path = remote_paths[file_number] - remote_path = ['/', @dir, path.basename.to_s].join('/').gsub %r{/+}, '/' + puts @pastel.bold("Uploading #{file} to #{remote_path} ...") - puts @pastel.bold("Uploading #{path} to #{remote_path} ...") - resp = @client.upload path, remote_path - display_response resp + resp = @client.upload(file, remote_path) + display_response resp + end end end From 121a955418b44db83bb17d2867729784e208f839 Mon Sep 17 00:00:00 2001 From: o-200 Date: Mon, 9 Feb 2026 03:21:39 +0700 Subject: [PATCH 2/2] add display docs --- lib/neocities/cli.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/neocities/cli.rb b/lib/neocities/cli.rb index efbc953..313d57e 100644 --- a/lib/neocities/cli.rb +++ b/lib/neocities/cli.rb @@ -491,6 +491,10 @@ def display_upload_help_and_exit #{@pastel.green '$ neocities upload img.jpg img2.jpg'} Upload images to the root of your site #{@pastel.green '$ neocities upload -d images img.jpg'} Upload img.jpg to the 'images' directory on your site + + #{@pastel.green '$ neocities upload cats/'} Upload 'cats' folder on your site + + #{@pastel.green '$ neocities upload -d images cats/'} Upload 'cats' folder to the 'images' directory on your site (it will be cats/images/) HERE exit @@ -571,7 +575,7 @@ def display_help_and_exit puts <