class Makit::Show
def age(path)
def age(path) if File.file?(path) modified = File.mtime(path) age = (Time.now - modified).to_f puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan) elsif File.directory?(path) modified = Makit::Directory.modified(path) age = (Time.now -modified).to_f puts "#{path} age is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_duration(age)}".colorize(:cyan) else puts "#{path} does not exist" end end
def directory_symbol
def directory_symbol # 📁 (U+1F4C1) – "File Folder" "\u{1F4C1}" end
def file(path)
def file(path) if File.file?(path) modified = File.mtime(path) age = (Time.now - modified).to_f humanized_size = Makit::Humanize.get_humanized_size(File.size(path)) #puts "#{file_symbol} ".colorize(:grey) + "#{humanized_size.rjust(10)} ".colorize(:cyan) + " #{path} ".colorize(:grey) puts "#{file_symbol} ".colorize(:grey) + "#{File.basename(path)} ".colorize(:green) + "#{humanized_size.rjust(10)} ".colorize(:cyan) + " #{path} ".colorize(:grey) # + "modified #{Makit::Humanize.get_humanized_timestamp(modified)}".colorize(:grey) + " age #{Makit::Humanize.get_humanized_duration(age)}".colorize(:grey) else puts "#{path} does not exist" end end
def file_symbol
def file_symbol #📄 (U+1F4C4) – "Page with Curl" #"\u{1F4C4}" "@" end
def files(path_array)
def files(path_array) path_array.each do |path| file(path) end end
def git_branch
def git_branch puts "#{git_branch_symbol} ".colorize(:grey) + "#{Makit::Git.branch}".colorize(:green) + " branch".colorize(:grey) end
def git_branch_symbol
def git_branch_symbol # 🌱 (U+1F331) – "Seedling" "\u{1F331}" end
def info(text)
def info(text) puts " ".colorize(:grey) + "#{text}".colorize(:cyan) end
def modified(path)
def modified(path) if File.file?(path) puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(File.mtime(path))}".colorize(:cyan) elsif File.directory?(path) puts "#{path} modified ".colorize(:grey) + "#{Makit::Humanize.get_humanized_timestamp(Makit::Directory.modified(path))}".colorize(:cyan) else puts "#{path} does not exist" end end
def size(path)
def size(path) if File.file?(path) puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(File.size(path))}".colorize(:cyan) elsif File.directory?(path) puts "#{path} size is ".colorize(:grey) + "#{Makit::Humanize.get_humanized_size(Makit::Directory.get_size(path))}".colorize(:cyan) else puts "#{path} does not exist" end end
def success(text)
def success(text) puts " ".colorize(:grey) + "#{text}".colorize(:green) end
def task(task)
def task(task) puts ("=" * 80).colorize(:grey) puts " ".colorize(:grey) + "#{task}".colorize(:green) #puts ("=" * 100).colorize(:grey) end
def task_symbol
def task_symbol # 🛠️ (U+1F6E0) Hammer and Wrench – Represents tools, suitable for tasks and automation. "\u{1F6E0}" end
def version(path)
def version(path) puts " #{Makit::Version.get_version_from_file(path)}".colorize(:green) + " found in #{path}".colorize(:grey) end
def versions(glob_pattern)
def versions(glob_pattern) Dir.glob(glob_pattern).each do |filename| puts " #{Makit::Version.get_version_from_file(filename)}".colorize(:green) + " found in #{filename}".colorize(:grey) end end