This commit is contained in:
2025-05-15 11:44:02 -05:00
parent ee7c4c9560
commit fad2223495
8 changed files with 113 additions and 36 deletions

6
lib/ensure_dir_exists.rb Normal file
View File

@@ -0,0 +1,6 @@
def ensure_dir_exists(directory_path)
unless Dir.exist?(directory_path)
FileUtils.mkdir_p(directory_path)
spawn_toast 'Directory Created', %(Poaster created #{directory_path}.), 10
end
end

3
lib/spawn_input_box.rb Normal file
View File

@@ -0,0 +1,3 @@
def spawn_input_box(title, text)
`kdialog --title "#{title}" --inputbox "#{text}"`
end

7
lib/spawn_radio_list.rb Normal file
View File

@@ -0,0 +1,7 @@
def spawn_radio_list(title, text, options_arr)
command = %(kdialog --title "#{title}" --radiolist "#{text}")
options_arr.each_with_index do |option, i|
command += %( #{i} "#{option}" off)
end
`#{command}`
end

3
lib/spawn_toast.rb Normal file
View File

@@ -0,0 +1,3 @@
def spawn_toast(title, text, seconds)
`kdialog --title "#{title}" --passivepopup "#{text}" #{seconds}`
end

5
lib/write_file.rb Normal file
View File

@@ -0,0 +1,5 @@
def write_file(directory, name, extension, content)
post_file = File.new(%(#{directory}/#{name}.#{extension}), 'w+')
post_file.syswrite(content)
post_file.close
end